name space in using visual studio?

Posted on 2012-08-21
Last Modified: 2012-08-31

I have both vs2008 and vs2010.

I have an application called Maxx with several projects named as
GUI, DAL, ConfigManager
I would like to have name spaces like this.
Maxx.GUI, MaxxDAL, Maxx.ConfigManager.

With C#, I do this in the properties of the VS projects.
I change the Assembly name and Default namespace.

It seems that it is a little different in

Can you help?

I would like to have a solution name, Maxx with several VB project named:
Maxx.GUI, MaxxDAL, Maxx.ConfigManager.

Also when I create a .vb page in each of those projects, I want the VS to add the namespace.
Question by:dkim18
    LVL 74

    Assisted Solution

    by:käµfm³d 👽
    The "Default Namespace" ("Root namespace" in VB) is simply the namespace that is applied whenever you add a new item--it has no bearing on existing items. To change existing items you will have to manually open up each file and make the change (a find/replace should work as well). In Solution Explorer, you can single-click a highlighted project, or right-click the project and select "Rename" to change the name as you like.

    Author Comment

    It seems that with c# project, it automatically added the namespace in the code.
    But in, it doesn't seem that way. Is that right?
    LVL 83

    Expert Comment

    VB.NET applies the root namespace to each file and class automatically
    LVL 40

    Assisted Solution

    by:Jacques Bourgeois (James Burger)
    In VB, simply open the Project properties (Project menu).

    In the Application tab, define the Root namespace such as Maxx.GUI. This becomes the namespace for the assembly (.exe or .dll).

    If you want, you can even create "sub-namespaces", many namespaces inside a given project. Simply enclose all the code of the class in a Namespace structure:

    Namespace Components
        Class YourClass

        End Class
    End Namespace

    The root namespace and the Namespace clause are appended together so that the namespace for your classe becomes Maxx.GUI.Components.YourClass

    Author Comment


    Thanks for that link.
    That's what I was confusing about.

    So in, I should not explicitly put namespace.
    LVL 83

    Accepted Solution

    Unless you are creating additional namespaces. If you do not need any name space (single exe etc) then you don't need to specify it in code. If you want spaces like MyProject.DAL and MyProject.Presentation etc then you specify MyProject as root namespace (which it is by default) and add

    Namespace DAL
    NameSpace Presentation

    in code files.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
    Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now