Application.run Method...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have to ask for login and password and authenticate user before display of
main mdi form. How can i call login form before MDI form as Application.Run
method is using MDI form instance???

Thanks in Advance...

A. K. Bhardwaj
 
Execute Application.Run with your authentication form and then according to
the return result show or not show the MDI form...

Or you want show authorization from on the top of the MDI one?
If so, you can call ShowModal method of the authorization form from the MDI
 
This way:

public static void Main()
{
try
{
// launch authentication form
SplashForm f = new SplashForm();
if (f.ShowDialog() == DialogResult.Ok)
// try connecting with supplied credentials
if (Connect(f.txtName.Text, f.txtPassword.Text))
// launch MDI parent form
Application.Run(new MDIMainForm());
}
catch(Exception ex)
{
MessageBox.Show(ex.Message,"MDIApp Error", MessageBoxButtons.OK,
MessageBoxIcon.Stop);
}
}
 
Back
Top