fb

Ads

Pages

Adding a “Souped-Up” Class [VB.net]

You already have your first class, which was created for you when you created the class library. This class is now called Patient, but it does not have a constructor (Public Sub New) as most new files in VB.NET do. You can add your own constructor if you want your class to have one.
It is also possible to create a new class that comes with a designer and a constructor already created. In the Solutions Explorer, right-click on the project name, choose
 

Add, and then choose Add Component. From the dialog that opens, choose Component class and click Open. This adds a new file to the project, which has only a class in it. This class, however, includes a designer, as shown in here.




The new class includes a designer, so you can perform actions such as dragging database connections to the designer to make it easier to create data components. Double-clicking on the designer opens the code window. You can see that there is more code in this class than in the class that was created with the class library project. If you examine the code, you’ll notice the following line:

Inherits System.ComponentModel.Component


This line makes the class inherit from the base Component class in
System.ComponentModel. If you added that line to your Healthcare class, you
would have access to the designer there.
For now, you’ll return to the generic Healthcare class you created earlier.

0 comments:

Post a Comment