2013-02-17 88 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