access to MenuStrip sub-items

dimmu

Member
Joined
May 28, 2009
Messages
9
Programming Experience
Beginner
hello everyone,

i have some problems accessing sub-items of a Menustrip.
i made a MenuStrip with 2 Items (File and Option), under the item "Option" i made another 2 items (Print and Save). i want to disable the option "Save" in at runtime like this :

MenuStrip1.Items("Save").Enabled = False.

but i get the error : Object reference not set to an instance of an object.
i'm sure that the sub-item "Save" exists but i don't know why i get this error.
Can anyone help ? please !

any idea will be apreciated.

thank you in advance
 
VB.NET:
Me.SaveToolStripMenuItem.Enabled = False
 
You can select the menu item in Designer and in properties window you can review its Name property, it is also visible in the control selection combo of properties window. Often one want to change the control name, esp. in case controls are auto-named Control1 Control2 and similar.
 
Back
Top