问题描述
我在Windows应用程序中有2种表单-LogonForm和ProcessForm.登录表单被设置为项目的启动对象".成功登录后,我将获得以下代码,以将控件从LogonForm转移到ProcessForm并关闭LogonForm(仅).
//实例化ProcessForm并显示ProcessForm MyProcessForm = new ProcessForm(InputData);
MyProcessForm.Show();
//关闭登录表单
this.Close();.
此代码实际上关闭了整个应用程序,而没有显示ProcessForm.
现在,如果我将this.Close()更改为this.Hide(),则会打开ProcessForm,但是当我关闭ProcessForm时,我可以看到应用程序仍在运行,因为"LogonForm"仍在隐藏状态.
关闭ProcessForm时,必须关闭整个应用程序.您能帮我怎么做吗?预先感谢您的帮助
I have 2 forms in a windows application - LogonForm and ProcessForm. The Logon Form is setup as the "Startup Object" for the project. Upon successful logon, I have the below code to transfer the control from LogonForm to ProcessForm and close the LogonForm (only).
//Instantiate ProcessForm and Show ProcessForm
MyProcessForm = new ProcessForm(InputData);
MyProcessForm.Show();
//Close the Logon Form
this.Close();
This code actually closes the entire application without showing the ProcessForm.
Now, if I change this.Close() to this.Hide(), the ProcessForm opens, but when I close the ProcessForm, I can see the application still running as the "LogonForm" is still in the hidden state.
When I close the ProcessForm, I have to close the entire application. Can you please help me with how to do it? Thanks in advance for your help
推荐答案
int main()<br />{<br /> // show the login form here. <br /> if(loginValidated)<br /> {<br /> // starts the application message loop<br /> Application.Run(new ProcessForm());<br /> /* .... */<br /> }<br />}
这篇关于在Windows应用程序中关闭启动表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!