Extending Through Inheritance
Inheriting from an existing control provides a new control with all of the functionality (methods, properties, and events) of the existing class without writing a single line of code. The only code you have to write is for the functionality you are adding; the base class provides everything else for you.
Making a Simple Example
To create your own inherited control, start by adding a new class to an existing project, or by creating a “Class Library” project. Then, in the new class file, go through the following steps to build your very own custom text box that only allows numeric input.
First, you can save yourself a bunch of time by inheriting from System.Windows.Forms.Textbox. You do this by adding Inherits System.Windows.Forms.Textbox ...
Get Microsoft® Visual Basic® .NET 2003 Kick Start now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.