Click here to Skip to main content
15,894,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a three form
mdiparent - information,login form and logout form
when i login with correct username and password menu on mdiparent form other than login and logout menu should enable true
Posted
Updated 13-Sep-20 5:08am

Hi,


So you need some Code to do so...


In MDI from expose two menu Item as public and initially those two menu items as disable.

Now on application start open login from as MDI child and after successful login
cast login.parent as your MDI from and set those two menu Item enable.
 
Share this answer
 
Hi,

try this in Login/logout form load event.

C#
Control[] controls = this.MdiParent.Controls.Find("Menu", true);
            foreach (Control ctrl in controls)
            {
                if (ctrl.Name == "Menu")
                {
                    MenuStrip strip = ctrl as MenuStrip;
                    strip.Items["login"].Enabled = false;
                    strip.Items["logout"].Enabled = false;
                }
            }


or once you get the menu control, you can enable/disable anything you want, you can change.

hope it helps.
 
Share this answer
 
Comments
hit91 17-Jul-12 8:59am    
Thank You mr.karthik
but it is not working

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900