Microsoft Visual Basic offers a very large set of functions. You can use most of those functions in your application.
If the .NET Framework doesn't have a class you are looking for, you can create one and be able to use it over and over again in different programs. You can even create a commercial class and be able to distribute or sell it. To make this possible, you can "package" one or more classes.
A library is a program that contains classes and/or other resources that other programs can use. Such a program is created with the same approach as the programs we have done so far. Because a library is not an executable, it doesn't need the Main() function. A library usually has the extension .dll.
A library can be made of a single file or as many files as necessary. A file that is part of a library can contain one or more classes. Each class should implement a behavior that can eventually be useful and accessible to other classes. The classes in a library are created exactly like those we have used so far. Everything depends on how you compile it.
To create a library, start by typing its code in a text file. Once the library is ready, to compile it, at the Command Prompt, you would type:
vbc /target:library NameOfFile.vb
and press Enter. After doing this, a library with the name of the file and the extension .dll would be created. If you want a custom name, use the following syntax:
vbc /target:library /out:DesiredNameOfLibrary.dll NameOfFile.vb
One of the most important sought goals in .NET is to allow different languages to collaborate, such as sharing code. One way this can happen is to be able to use the functionality of one language into another. As no library is ever complete, you may still need functionality that is not easily found. Furthermore, you may be working with a team of C++ programmers who have already created a set of functions or complex operations. You should be able to use that existing code.
In previous years, it used to be a challenge to create a library, especially in C++. Fortunately, Microsoft Visual C++ now makes it particularly easy to create one, because a wizard highly assists you. To create a library, first display the New Project dialog box. After specifying Visual C++, in the middle list, click Class Library and give it a name. In the body of the file, you can create the classes and/or functions as you see fit.
Module Exercise Declare Auto Function SpecifyTitle Lib "Kernel32.dll" Alias "SetConsoleTitle" (ByVal msg As String) As Boolean Public Function Main() As Integer SpecifyTitle("Microsoft Visual Basic Application") Return 0 End Function End Module