MenuStrip items Enable/Disable vb.net -


how programaticaly enable or disable menustrip items.

example if have this

enter image description here

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 toolstripmenuitems 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

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

node.js - How to abort query on demand using Neo4j drivers -