Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

Overriding Base Methods Using the Visual Basic Code Editor

Visual Studio .NET 2003

When working with Visual Basic classes in Windows Forms, you may need to override a method defined in a base class. In addition to providing a way to create event handlers while writing code, the Visual Basic Code Editor also allows you to override methods contained in your base class.

To override a base class method using the Visual Basic Code Editor

  1. Open the form that you want to use in the Code Editor.
  2. From the Class Name drop-down list at the top of the Code Editor, choose (Overrides).

    A list of the methods is added to the Event list.

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

    A method is added to your form's class and the Overrides keyword is added to the method signature. The following code demonstrates an example of an overridden form method:

    ' Visual Basic
    Protected Overrides Sub Finalize()
       'Implementation Code Added Here
    End Sub
    

See Also

Event Handling in Windows Forms | Creating Event Handlers in the Visual Basic Code Editor | Creating Windows Forms

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.