mdi parent problem
-
Hello Friends, I had an login form and an mdi parent form. On the load event of mdiparent form I had called the login form as showDialog If user cancel the login form then the mdi parent form should also be closed. but i am not able to do so. I had tried to close it by making object of the mdiparent form but no use. Only login form is closed not the mdiparent form. closing of form is on the click event of cancel button in login form. Please help, Regards, rahul saini
-
Hello Friends, I had an login form and an mdi parent form. On the load event of mdiparent form I had called the login form as showDialog If user cancel the login form then the mdi parent form should also be closed. but i am not able to do so. I had tried to close it by making object of the mdiparent form but no use. Only login form is closed not the mdiparent form. closing of form is on the click event of cancel button in login form. Please help, Regards, rahul saini
-
Hello Friends, I had an login form and an mdi parent form. On the load event of mdiparent form I had called the login form as showDialog If user cancel the login form then the mdi parent form should also be closed. but i am not able to do so. I had tried to close it by making object of the mdiparent form but no use. Only login form is closed not the mdiparent form. closing of form is on the click event of cancel button in login form. Please help, Regards, rahul saini
Have you done anyting according to this:
DialogResult result = loginForm.ShowDialog();
if(result == DialogResult.Ok)
{
//code for checking credentials or what ever...
}
else if(result == DialogResult.Cancel)
{
//User cancelled login. Close MDI parent.
this.Close();
}or else you might try in loginforms cancel button clicked event:
public void buttonCancel_OnClicked(object sender, EventArgs e)
{
(this.Parent as Form).Close(); //Not sure if you can close parent from child.
this.Close();
}-Larantz
for those about to code, we salute you
http://www.tellus-software.com