34,333
edits
Changes
→Creating an Event
[[Image:visual_basic_form2.jpg]]
== Creating an Event Handler ==
The next step is to make the ''Close'' button do something when it is pressed. Bfore Before we do that , however, we need to give the button a more meaningful name. Visual Studio have 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: