我試圖在新創建的窗體之間切換,但如果我在創建新窗體之前關閉像下面那樣的舊窗體,整個應用程序將退出;如何關閉一個窗口,以防止應用程序終止?
Inital創作
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Login());
}
此登錄屏幕上導致創建其中的那一刻,我躲在屏風,以保持應用程序運行的新窗口;
new MainScreen(uID, this).Show();
this.Hide();
內MainScreen我有一個「更改用戶」按鈕,這意味着我需要建立一個新的登錄屏幕,但下面的代碼只是退出整個運行的應用程序;
Login newLoginForm = new Login(this);
mainLoginForm.Close();
我在設計這個完全錯誤的方式還是我只是沒有使用正確的方法?任何幫助都會很棒。
[Windows窗體中的多個用戶](http://stackoverflow.com/a/8898718/719186)可能會有幫助。 – LarsTech 2012-02-19 21:49:09