开发者

How to stop a form from loading in c# windows forms

开发者 https://www.devze.com 2023-03-05 08:19 出处:网络
I\'ve a windows form application where it ask the user to login before loading the entire form. If the user cancel the login then i\'ve to stop the form loading and quit the application. In cancel_Cli

I've a windows form application where it ask the user to login before loading the entire form. 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());. I treid with this.Dis开发者_JS百科pose() and Application.exit() also but didnt worked. Please help me

Thanks in Adv.


    public static void Main()
    {
        using (var signInForm = new SignInForm())
        {
            if (signInForm.ShowDialog() != DialogResult.OK)
                return;
        }
        Application.Run(new MainForm());
    }


The following link might help you solve the problem:

C#: How to prevent main form from showing too early

Hope this helps...

0

精彩评论

暂无评论...
验证码 换一张
取 消