Share via


Playing with namespaces

The Root Namespace property sets the base namespace for all files in the project. If you want to set the the root namespace of a Windows Form project it is done through the following steps.

1.       Select My Project

 

2.       Within the application tab it can be set

By default all namespaces in a project are based on the root namespace. Visual Studio assigns your project name as the default root namespace for all code in your project. By default if add a new namespace element into a class using the following steps

Namespace OrderData

    Public Class Orders

 

    End Class

End Namespace

When I declare an instance of this class I could use the following to show the entire namespace

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim lvarOrder As New WindowsApplication3.OrderData.Orders

 

    End Sub

Creating a nested hierarchy for an application can be done using the following.

Namespace OrderData.OrderInfo

    Public Class OrderStuff

 

    End Class

End Namespace

When this is declared I would call this as

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

       

 

        Dim LvarorderInfo As New WindowsApplication3.OrderData.OrderInfo.OrderStuff

 

    End Sub