Changes

Creating Top-Level Menus in Visual Basic

No change in size, 17:33, 24 July 2007
Programming Menu Items in Visual Basic
== Programming Menu Items in Visual Basic ==
No that we have designed a minu menu system in Visual Studio, the next step is to make the menu items do something when they are selected by a user. This is achieved using the event procedures of the individual menu options. We will demonstrate this using our example by wiring up the Exit menu option so that it closes the application, and by writing an event procedure for the ''Save on Exit'' menu option to change the checked status of the ''Checked'' menu item.
We will begin by writing a Visual Basic event procedure for when the Exit menu option is selected. In Visual Studio click on the ''File'' menu so that the menu drops down and double click on the ''Exit'' menu option. Visual Studio will subsequently display the ''Click'' event procedure for this menu item. All we need to do is add a Close() call to this procedure to exit the application:
</pre>
Press '''F5''' to build and run the application once again. When ''Save on Exit'' is clicked, the checked status will change to eitehr either, set or unset depending on the current setting.