ADO.NET Programming in Visual Basic .NET By Steve Holzner, Bob Howell
Table of Contents
Chapter 11. Creating Your Own Data Control
Shall we begin? Start by closing any open projects or solutions. Create a project. When prompted, select Windows Control Library. Name the project DataControl. This will create a Windows Control Library project with a default UserControl class called UserControl1.vb. Select UserControl1.vb in the Project window and open the code view. Notice that the control is just a class that inherits from windows .forms.UserControl. Change the programmatic name of the class to ucDataNav for data navigator. Do this by simply overtyping UserControl1 with ucDataNav right in the source code. To be consistent let's also change the source code file name to match. Do this right in the Project window. Note two things: Changing the name in the window renames the disk file and there is no code except that which was generated by the designer. This is collapsed in the region labeled Windows Form Designer Generated Code. Yet there are already lots of properties listed in the Properties window. Where did they come from? As with forms, they are defined in the base class. Ah, the beauty of inheritance.