34,333
edits
Changes
→Programming Visual Basic Context Menu Options
== Programming Visual Basic Context Menu Options ==
Now that we have designed the context menu, and associated it with the form object, we need to write some Visual Basic code to cause the ''MyTextBox'' object to hide and show depending on the menu selection. This is achieved by implementing ''Click'' event procedures for the hide and show menu items. In Visual Studio, select the ''TextBoxMenu'' object in the panel beneath the form. Once selected, a representation of the context menu will appear in the form. Douible click on the ''Hide'' menu option to display the Click event procedure code for this menu option. We now need to write some Visual Basic code to call the ''Hide()'' method of the ''MyTextBox'' object as follows: