/* 1.定义Form1以对话框方式弹出 */
1 Form1 form1= new Form1(); 2 if (Form1.ShowDialog() == DialogResult.OK) 3 { 4 MessageBox.Show(Form1.Param); 5 }
/* 2.在Form1窗口中定义变量 */
1 public string Param;
/* 3.给变量复制并返回DialogResult.OK结束对话 */
1 Param = “Hello.”; 2 3 this.DialogResult = DialogResult.OK;