[英]How to stop a form from loading in c# windows forms
I've a windows form application where it ask the user to login before loading the entire form. 我有一个Windows窗体应用程序,它要求用户在加载整个表单之前登录。 If the user cancel the login then i've to stop the form loading and quit the application.
如果用户取消登录,那么我将停止加载表单并退出应用程序。 In cancel_Click() method im calling this.Close(), but it is generating exception at Application.run(new Form1());.
在cancel_Click()方法中我调用this.Close(),但它在Application.run(new Form1());中生成异常。 I treid with this.Dispose() and Application.exit() also but didnt worked.
我喜欢这个.Dispose()和Application.exit()但也没有用。 Please help me
请帮我
Thanks in Adv. 谢谢Adv。
The following link might help you solve the problem: 以下链接可帮助您解决问题:
C#: How to prevent main form from showing too early C#:如何防止主表单显示得太早
Hope this helps... 希望这可以帮助...
public static void Main()
{
using (var signInForm = new SignInForm())
{
if (signInForm.ShowDialog() != DialogResult.OK)
return;
}
Application.Run(new MainForm());
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.