Changes

Jump to: navigation, search

A Simple Visual Basic Example

No change in size, 14:19, 14 August 2007
Creating an Event Handler
== Creating an Event Handler ==
The next step is to make the ''Close'' button do something when it is pressed. Before we do that, however, we need to give the button a more meaningful name. Visual Studio have has given the button a default name of ''Button1''. While this is fine for a small design , it will quickly become difficult to work with such names in larger applications containing many buttons. With the Button selected in the Form, scroll up to the top of the properties list and change ''(Name)'' from ''Button1'' to ''closeButton''.
Having changed the name we can now add an event to the button. Double click on the ''Button'' in the Form to display the event code for the ''closeButton'' control. Visual Studio will display the following code:

Navigation menu