简体   繁体   English

关闭MDI后,带有登录表单的MDI表单不会返回登录

[英]MDI form with login form does not return to login after closing MDI

I have an MDI form that the user can access after login, when the user closes session it should go back to the login form instead it opens the login form and immediately closes it and the MDI form, too. 我有一个MDI表单,用户登录后可以访问,当用户关闭会话时,应该回到登录表单,而是打开登录表单,然后立即关闭它和MDI表单。

I am just calling the Close() method when the user click the log off button. 当用户单击注销按钮时,我只是在调用Close()方法。

I'm not sure how you're doing it but I would say to use something like this 我不确定您的情况如何,但我会说要使用类似的方法

//on login form
private void Login()
{
   //check if the login is right
   MdiForm formName = new MdiForm();
   this.Hide(); // so the Login Form is not visible
   formName.ShowDialog(); //opens the mdi and does whatever it needs
   this.Show(); //after the mdi closes go back to here
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM