문제

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.Dispose() 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...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top