Enabling, Disabling, and Visibility

So far, all of the menu items you have seen in the previous examples have been enabled (meaning they can be clicked) and visible (meaning you can see them). Often, menu items have a context in which they can be used. For example, a File-Save menu item in an application would not be appropriate if the application does not currently have a file opened.

To accommodate the situations where you need to provide menu items that have contextual meaning, MenuItems can be disabled or invisible. Disabling a MenuItem object is done by setting the Enabled property to False. This causes the MenuItem to have a grayed-out appearance and cannot be clicked in the application.

Menu items can also be invisible, if you choose, ...

Get Visual Basic® .NET by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.