Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3276846
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:18:14+00:00 2026-05-17T19:18:14+00:00

If I create a new class library project in VB.NET, I can create subfolders

  • 0

If I create a new class library project in VB.NET, I can create subfolders (a la C#), add WinForm objects to these subfolders, and then specify a namespace:

Namespace Sub1.Sub2
    Public Class SomeForm
        Public Sub New()
            InitializeComponent()
        End Sub
    End Class
End Namespace

This resolves as ProjectRootNamespace.Sub1.Sub2.SomeForm, which is good.

However, if I create a new WinForms project in VB.NET, and attempt the same thing, I get this error in the designer:

The class SomeForm can be designed, but is not the first class in the file. Visual Studio requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try loading the designer again.

Is there a way to have forms in sub-namespaces of a VB.NET WinForms app instead of in the root namespace?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T19:18:15+00:00Added an answer on May 17, 2026 at 7:18 pm

    Are you renaming the namespaces in both the Form.vb as well as the Form.Designer.vb? you need to make sure that both files declare the same object.

    Example Form.vb

    Namespace X
        Namespace Y
            Public Class Form1
    
            End Class
        End Namespace
    End Namespace
    

    And Form.Designer.vb

    Namespace X
        Namespace Y
            <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
            Partial Class Form1
                Inherits System.Windows.Forms.Form
                
                <System.Diagnostics.DebuggerStepThrough()> _
                Private Sub InitializeComponent()
                    ...
    
            End Class
        End Namespace
    End Namespace
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was trying to create a new Class Library project targeted for the .NET
I want to create a new object using Class::DBI. One of the fields of
When you create an instance of a class with the new operator, memory gets
For a new project that I'm doing in PHP I've created an SQLMethods class
I create new ASP.NET web application that use SMTP to send message. The problem
I am attempting to create new membership users in an Ektron CMS400.NET-based website by
I'm a .Net developer, but for my current project I have to create some
I have a class library that I have written in C#.net. I want to
I am in the middle of (trying) to create a Class Library available for
I have a class library built on .net 3.5, I wanted to use it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.