Question

i have two form,home and login.On home there is menu called file and menu items like login,logout when i run the application login form will open and after login home page will open.menuitems on home form will enabled=true when login is successfully i click on logout menu this will enabled=false all menu other than login.When i click on login menu login form will open,after successfull login my home form menu should be enabled=true

So my problem is that i am not been able to enabled=true menu from my login form

Était-ce utile?

La solution

Hope you are showing LoginForm as ShowDialog(), not MDI Child. And if your Login is successful you can set the dialog result to OK or Yes. And in the next statment you can enable / disable the menu items

mnuLogin_Click()
{
FrmLogin frmLogin = new FrmLogin();
if(frmLogin.ShowDialog() == DialogResult.OK)
{
//Enable menu here.
}
}

Hope it works :)

Autres conseils

Don't do it from your login form but from the main form. Also don't do it immediately after login but each time the menu is about to be opened, set each item enabled property.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top