R
RP
I have a login form. I want to open the main MDI form if the login was
successful and want to close the login form. I tried below code, but
it is not working:
======================================
private void OK_Click()
{
//If login successful
try
{
MainForm MainWindow = new MainForm();
MainWindow.Show();
}
Catch (Exception ex)
{
.................
}
Finally
{
this.close();
}
}
=======================================
In the above code, this represents Login Form. But it closes the next
form i.e., the MainForm since we initialized its instance above. How
to close the Login Form and open the MainForm.
successful and want to close the login form. I tried below code, but
it is not working:
======================================
private void OK_Click()
{
//If login successful
try
{
MainForm MainWindow = new MainForm();
MainWindow.Show();
}
Catch (Exception ex)
{
.................
}
Finally
{
this.close();
}
}
=======================================
In the above code, this represents Login Form. But it closes the next
form i.e., the MainForm since we initialized its instance above. How
to close the Login Form and open the MainForm.