Share via


How to: Create Event Handlers in the Visual Basic Code Editor

The Visual Basic Code Editor provides an easy way to create event handlers for your Windows Forms. Although it does not allow you to connect multiple events to a single event handler (see How to: Connect Multiple Events to a Single Event Handler in Windows Forms), it does provide a quick and easy way to create event handlers while working on your form's code without having to display the form in the Windows Forms Designer.

To create an event handler using the Visual Basic Code Editor

  1. In the Code Editor, from the Class Name drop-down list, choose the form or control that you want to create an event handler for.

  2. From the Method Name list at the top of the Code Editor, choose the event that you want to create an event handler for.

    Visual Basic creates an event handler and adds it to your form's class.

See Also

Tasks

How to: Create Event Handlers Using the Designer

Troubleshooting Inherited Event Handlers in Visual Basic

Concepts

Event Handlers Overview (Windows Forms)

Other Resources

Creating Event Handlers in Windows Forms

Creating a New Windows Form