Changes

Jump to: navigation, search

Understanding Visual Basic Events

887 bytes added, 17:07, 17 July 2007
Wiring Up Events in Visual Studio
Select each control in turn and using the Properties panel change the Name of the controls to ''myButton'', ''myLabel'' and ''inputText'' respectively. The Form design is now complete and we can now begin to connect the events to event handlers.
 
We will begin by defining an event procedure for the TextBox. To access the ''inputText'' control event procedures simply double click on the TextBox control in the Form. Visual Studio will subsequently display the event procedures for the ''inputText'' control. By default Visual Studio picks the most common event, the ''TextChanged'' event, and creates a stub of the subroutine to be called when that event is triggered by the user.
 
In our example we want every keystroke performed by the user in the TextBox to be displayed by the Label control. In this case the ''TextChanged'' event is exactly the event we want. If, however, we had wanted to write the procedure for a different event on the TextBox we could simply click on the right-hand drop down menu above the code area to view and and select from a list of events available on this type of control:
 
[[Image:Exampl.jpg]]

Navigation menu