我有2个表格..
从第一种形式我调用第二种形式......在第二种形式中我做了一些计算,我想在关闭第二种形式后得到第一种形式的结果。
第一种形式代码
public partial class XtraForm1 : DevExpress.XtraEditors.XtraForm
{
String s = "";
public XtraForm1()
{
InitializeComponent();
}
private void simpleButton1_Click(object sender, EventArgs e)
{
s = textEdit1.Text;
XtraForm2 x = new XtraForm2(ref s);
x.ShowDialog();
MessageBox.Show(s); // Here I want to get the data from 2nd form.
}
}
第二种形式代码
public partial class XtraForm2 : DevExpress.XtraEditors.XtraForm
{
string s2 = "";
public XtraForm2(ref string s1)
{
InitializeComponent();
s2 = "hai";
s1 = s2;
}
private void simpleButton1_Click(object sender, EventArgs e)
{
// here i do some operations and i want to store it in variable s1 so that i will get the result in 1st form.
this.Close();
}
}