Technical Training
VB.NET 2005Visual Studio.NET Namespaces
Visual Studio.NET Namespaces
The .NET Framework class library has thousands of classes which are needed for developing and deploying solutions. In order to organize all those classes for ease of use .NET Framework uses namespaces. This Gives the Classes their own space and prevents conflicts between the various names in these classes. For instance if two classes contain a method Paint(), then to avoid conflicts in names we can place these classes in two different namespaces. Thus namespaces allow classes to be grouped in a consistent, hierarchical manner.
The writing convention is that the word after the right–most dot is the name of the type and the string up to the dot is the name of the namespace. We shall see an example of this in the following statement.
System.Windows.Forms.Button
In the above statement the name of the namespace is System.Windows.Form and the type name is Button.
A namespace can contain classes, structures, enumerations, delegates, interfaces, and other namespaces. Namespaces can be nested and can have any number of members. The typical namespaces begin with Microsoft or System. The new namespace My is added in .NET 2005. If there is a conflict in the namespace in such a way that even fully qualified Object name is also not usable, then the classes cannot be used.
You can create a namespace by using the Namespace … End Namespace block. With in the namespace Block, you can create classes, enumerations, structures, delegates, interfaces, or other namespaces. It is not imperative that all the code should be kept in one single file. A namespace can span multiple files and even multiple assemblies.
Namespace VBTutorial
Class Class1
…….
End Class
Namespace Lesson2
Class Class2
…..
Public Sub Teach()
End Sub
End Class
End namespace
End Namespace
In order to access the methods teach defined in class2 you have to instantiate the class Class2.
Dim lessonObj as new VBTutorial.Lesson2.Class2
lessonObj.Teach()
Alternatively you can use the following lines of code:
Imports VBTutorial.Lesson2
Dim lessonObj as new Class2
lessonObj.Teach()
Let us quickly see some of the namespaces defined in .NET
|
System.ComponentModel |
Liending and design time implementation of components |
|
System.Data |
Data Access |
|
System.Data.SQLClient |
SQL Server data access |
|
System.Data.OLEDB |
OLE DB data access |
|
System.Data.SML |
XML processing |
|
System.Diagnostics |
Provides debugging and tracing services |
|
System.Messaging |
Microsoft Message Queue management |
|
System.Net |
Programmable access to network protocol |
|
My.Computer |
Gives access to local computer |
|
My.User |
Gives access to the local user logged in |
VB.NET 2005
- VB.NET 2005 Free Training
- The .NET Framework Architecture Part 1
- The .NET Framework Architecture Part 2
- Application Class and Message Class
- Implementing Class Library Object
- Visual Studio.NET Namespaces
- .NET Assemblies
- Differences between VB.NET 1.0 and VB.NET 2.0
- Introducing VB.NET Windows Forms
- Visual Studio Windows Forms Designer
- Exploring the Forms Designer generated code
- Setting and Adding Properties to Windows Form
- Implementing Inheritance
- Event Handling In Visual Basic .NET
- Building Graphical Interface elements
- .NET Common Windows Forms Controls Part 1
- .NET Common Windows Forms Controls Part 2
- Common Controls and Handling Control Events
- DomainUpDown and NumericUpDown Controls
- Dialog Boxes in Visual Basic .NET
- Visual Studio Adding Controls to Windows Form
- VB.NET Validation Controls
- Working with Menu Controls
- VB.NET MDI Applications
- .NET Exceptions
- VB.NET Creating and Managing Components Part 1
- VB.NET Creating and Managing Components Part 2
- Simple Data Binding
- .NET Complex Data Binding
- .NET Data Form Wizard
- Data Manipulation with ADO.NET
- SQL Server Stored Procedures
- SQL Server Ad Hoc Queries
- Finding and Sorting Data in DataSets
- ADO.NET Object Model
- Working with DataSets
- Using XML Data
- Working with File System in .NET
- Creating Web Service
- Instantiating - Invoking Web Services, Creating Proxy Classes with WSDL
- Web Reference and Web Services
- Web Services - SOAP, WSDL, Disco and UDDI
- Web Application Testing in VB.NET 2005
- Web Application Tracing and Debugging
- Working with Legacy Code and COM Components
- ActiveX Controls and Legacy Code
- Windows Application Testing
- VB.NET Windows Application Testing
- Tracing VB.NET Windows Application
- Debugging Windows Applications In Visual Studio.NET 2005
- Deploying Windows Applications In Visual Studio.NET 2005
- Customizing Setup Project in Visual Studio.NET 2005
- Shared Assembly
- Microsoft .NET Creating Installation Components
- The Registry Editor in Visual Studio.NET 2005
- The File Types Editor







