Mouse Click
-
I have a MDI application frm_parents is the MDI parents with a main menu and shortcut. When it load, it load MDI Child frm_login. It's basicaly a login frame that I've created. I would like to create a code where when frm_login is still active, no other command (mouse or shortcut) can be used. I made a active flag (frm_login_activated). It's equal to true when frm_login is loaded, and false when frm_login is closed. Does anyone know how to do it? Thank you very much in advance.
-
I have a MDI application frm_parents is the MDI parents with a main menu and shortcut. When it load, it load MDI Child frm_login. It's basicaly a login frame that I've created. I would like to create a code where when frm_login is still active, no other command (mouse or shortcut) can be used. I made a active flag (frm_login_activated). It's equal to true when frm_login is loaded, and false when frm_login is closed. Does anyone know how to do it? Thank you very much in advance.
Why would you make the login form a child form? Why not make it a normal dialog form and show it, from your main form, with .ShowDialog(). This way, the form is displayed as a modal dialog, you can't use the underlying main form until this dialog is OK'd or Cancel'd, and you can get the return value from the form so your main code knows weather or not the user logged in and can take appropriate action. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Why would you make the login form a child form? Why not make it a normal dialog form and show it, from your main form, with .ShowDialog(). This way, the form is displayed as a modal dialog, you can't use the underlying main form until this dialog is OK'd or Cancel'd, and you can get the return value from the form so your main code knows weather or not the user logged in and can take appropriate action. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Yes, you are right. I didn't think about that one :) It worked perfectly. Thanks a lot :)
-
Yes, you are right. I didn't think about that one :) It worked perfectly. Thanks a lot :)
1-hi... 2-make an instance of chlid form in the parent form fchild f2=new fchild(); set the flag that u made it in the child form as public and write this code in parent form private bool f1flag; the menuitem1_click(.......,........) { f1flag=f2.f2flag; if(f1flag==true) { f2=new Form2(); f2.MdiParent=this; f2.Show(); } else{f2.activate();} } ....and in child form on the event close set the f2flag=true and on the f2_load set f2flag=false hi i am ezak neno
-
1-hi... 2-make an instance of chlid form in the parent form fchild f2=new fchild(); set the flag that u made it in the child form as public and write this code in parent form private bool f1flag; the menuitem1_click(.......,........) { f1flag=f2.f2flag; if(f1flag==true) { f2=new Form2(); f2.MdiParent=this; f2.Show(); } else{f2.activate();} } ....and in child form on the event close set the f2flag=true and on the f2_load set f2flag=false hi i am ezak neno
That's a lot of garbage to go through when all you need for a Login Form is wheather or not the user was successfully logged in or not. I like this in the main form better:
frmLoginForm myLoginForm = new frmLoginForm;
DialogResult loginResult = myLoginForm.ShowDialog();
if (loginResult == DiaglogResult.OK)
{
// The login was OK. Enable the controls as needed.
}
else
{
// The login failed. Disable the controls as needed.
// Or might want to quit the application.
}RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome