R – Setting the namespace of a WinForms UserControl in VB.NET


How do you define your UserControls as being in a namespace below the project namespace, ie. [RootNameSpace].[SubSectionOfProgram].Controls?

Edit due to camainc's answer: I also have a constraint that I have to have all the code in a single project.

Edit to finalise question: As I suspected it isn't possible to do what I required so camainc's answer is the nearest solution.

Best Solution

I'm not sure if this is what you are asking, but this is how we do it.

We namespace all of our projects in a consistent manner, user controls are no different. We also namespace using the project settings window, although you could do it through a combination of the project window and in code.

Each solution gets a namespace like this:


So, our user controls are normally in a project called "Controls," which would have a namespace of:


If we have controls that might span several different solutions, we just namespace it like so:


Then, in our code we will import the library, or add the project to the solution.

Imports OurCompany
Imports OurCompany.Common
Imports OurCompany.Common.Controls

We also name the folders where the projects live the same as the namespace, down to but not including the company name (all solutions are assumed to be in the company namespace):


-- or --



Hope that helps...