MenuStrip items Enable/Disable vb.net -
how programaticaly enable or disable menustrip items.
example if have this
i want disable item2 , item3. tried with
menustrip1.items("item 1").enabled = false menustrip1.items(2).enabled = false
going image, appears want disable/enable things in dropdown.
each top level menu item object contains actual drop down items - menustrip container them. so, if have file | view | tools
menu, there 3 toolstripmenuitem
s work with, each dropdownitems
collection of entries. so:
viewmenuitem.dropdownitems(2).enabled = false
this disables 3rd dropdown item on view menu. yours might named itemstoolstripmenuitem
. ui designer doesn't use key create/add new dropdown items, string overload wont work unless adding them manually:
' create new dd item dim foo = new toolstripmenuitem("foo", nothing, addressof footoolstripmenuitem_click, "foo") ' add menu viewmenuitem.dropdownitems.add(foo) ' access key viewmenuitem.dropdownitems("foo").enabled = true
Comments
Post a Comment