In .NET, library are usually organized using namespaces. You can think of these as the "real" object libraries. References can be thought of as just the box they come in. Here's the "official" description from Microsoft:
Namespaces organize the objects defined in an assembly. Assemblies can contain multiple namespaces, which can in turn contain other namespaces. Namespaces prevent ambiguity and simplify references when using large groups of objects such as class libraries.
After you add the Microsoft.VisualBasic.Compatibility library to your project, two new entries will be added, but not selected, to the Imported Namespaces listbox in Project Designer. Scroll to the bottom and you'll see:
- Microsoft.VisualBasic.Compatibility
- Microsoft.VisualBasic.Compatibility.VB6
Although the "VB6" namespace is the only entry in the first one, it does illustrate the point that a class library is actually a tree structured container.
The concept of "importing" simply means that a namespace at a specific path can be searched automatically by Visual Studio or the Visual Basic compiler.
Strictly speaking, the "Imports" keyword isn't a Visual Basic statement. It's a compiler option. That's why it has to be placed before the other statements in your source code. All the choices that are available to you are listed in the Imported Namespaces listbox. When you click the checkbox to select one, then you can simply use the methods and properties in that namespace directly in your program code. (A Quick Tip all about Imports can be found here.)
Using the Microsoft.VisualBasic.Compatibility.VB6 namespace method to convert VB6 twips into VB.NET pixels as an example, all of these code blocks are equivalent:
Imports Microsoft Public Class Form1Private Sub Form1_Load( ... VisualBasic.Compatibility.VB6.TwipsToPixelsX(100)End Sub End Class Imports Microsoft.VisualBasic Public Class Form1Private Sub Form1_Load( ... Compatibility.VB6.TwipsToPixelsX(100)End Sub End Class Imports Microsoft.VisualBasic.Compatibility Public Class Form1Private Sub Form1_Load( ... VB6.TwipsToPixelsX(100)End Sub End Class Imports Microsoft.VisualBasic.Compatibility.VB6 Public Class Form1Private Sub Form1_Load( ... TwipsToPixelsX(100)End Sub End Class
Or, if the Microsoft.VisualBasic.Compatibility.VB6 namespace is checked in the Imported Namespaces listbox, you can just code this:
TwipsToPixelsX(100)
(Note: VB.NET upgrades the way screen forms are measured from the virtually unknown twips to the almost universal pixel.)