fb

Ads

Pages

Creating the Class Library [VB.net]

To see how to build your first class library, start Visual Studio.NET and from the Start Page, click Create New Project. From the New Project dialog box, choose Visual Basic Projects in the Project Types list box, and then choose Class Library in the Templates list box. Name the project Healthcare and click the OK button. At this point, a new class is created for you. The first thing you might notice is that the class does not have a designer by default, making it different from most VB.NET application types. Instead, you start with basically the same thing you had in VB6: an empty class.
 



Right now, you have one class, named Class1. Here is where things start to diverge from VB6. In VB6, you had one class per class module, and these were compiled into a single component. Class modules had a .CLS extension. In VB.NET, your module has a .VB extension, and a single source code file can contain more than one class. One or more source code files can be compiled into an assembly. You can create a new class at any time using the Class...End Class block. In the code window, change the class definition line to name the class Patient. In other words, change this line:
Public Class Class1
to this:
Public Class Patient

 
You have now changed the class name, but if you look in the Solution Explorer window, or just look at the tab on the current code window, you see the filename is still Class1.vb.
Right-click on the Class1.vb icon in the Solution Explorer and choose Rename.
Name the file Healthcare.vb. You should see the tab in the main code window
change to reflect the new filename. What you have done is change the name of the file that holds one or more classes.

0 comments:

Post a Comment