2013-02-17 46 views

回答

0

将此代码放在您的button_click事件:

newform nf = new newform(); //or whatever the name of your second form is 
this.Hide(); //to hide your mainform 
nf.ShowDialog(); 
this.Show(); //to show your mainform after closing your new form 
nf.Dispose(); //optional 
+0

非常感谢你! :d – Ryan 2013-02-17 15:37:48

0

您可以覆盖OnFormClossing事件

protected override void OnFormClosing(FormClosingEventArgs e) 
{ 
    // code that u want 
} 
+0

问题。我会在哪里放置这两个表单并如何相互沟通? – Ryan 2013-02-17 05:46:12

+0

你尝试过使用form2.ShowDialog();可能这是你要求的 – 2013-02-17 07:17:41

相关问题