Share via

WHen trying to show form in visual studio get error "The designer could not be shown for this file because none of the classes within can be designed. The base class 'System.Void' cannot be designed

Eric Hedman 0 Reputation points
2026-05-02T20:12:19.88+00:00

Earlier this year after installing an update to visual studio for an application with a very long history, When I would go into my VB.net application, on most forms I would get the error above. I've had to recreate dozens of forms because of the error in the title of this question. I had started recreating a specific form and this error returned. What do I do to permanently fix this? #VB.NET

Developer technologies | Visual Studio | Setup

2 answers

Sort by: Most helpful
  1. Adiba Khan 2,345 Reputation points Microsoft External Staff
    2026-05-04T05:53:22.7666667+00:00

    Thank you for reaching out. This error typically indicates that the Windows Forms designer is unable to resolve the form' base type, most commonly due to code corruption, partial class mismatch, or compilation issues after an update.

    Recommended trouble shooting steps:

    1. Ensure the project builds successfully
      1. Go to Build-> Rebuild Solution
      2. Fix any compile-time errors first The designer relies on a successful build to render forms.
    2. Verify from inheritance Open your code file and confirm it correctly inherits from Form:
         Public Class Fore1
         	Inherits System.Windows.Forms.Form
         End Class
      
      If this was accidently modified , it can result in System.Void errors.
    3. Check Partial Class consistency Ensure both files match:
      1. Form1.vb
      2. Form1.Designer.vb
      They must:
      1. Have same class name
      2. Be marked as Patial Class Example
              Partial Class Form1
        
    4. Inspect InitializeComponent Make sure:
      1. InitializeComponent() exists in Designer.vb
      2. It is called inside the constructor
              Public Sub New()
              	InitializeComponent()
              End SUb
        
    5. Delete Temporary files Close Visual Studio and delete
      1. .vs folder
      2. bin folder
      3. obj folder Then reopen the solution and rebuild.
    6. Check for designer file corruption If the issue persists after an update:
      1. Compare the affected form with a newly created form
      2. Look for missing attributes like:
              <Global.Microsoft.VisualStudio/CompileServices.DesignerGenerated()>
              
        
    7. Test with a new form
      1. Add a new Windows Form to the project.
      2. Open it in designer if the new form works, the issue is isolated to specific form files.
    8. Repair Visual Studio(if issue is widespread) If multiple forms are affected
      1. Go to Visual Studio Installer
      2. Run repair.

    Please try the steps shared above and let me know if this resolves the issue.

    If it works, you may mark this reply as the Accepted Answer — this helps other customers with similar questions find the solution faster.

    0 comments No comments

  2. Q&A Assist
    2026-05-02T20:12:35.1266667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The error means the Windows Forms Designer can’t find or load a valid base class for the form, so it falls back to System.Void and refuses to design it. This is a design‑time problem, not a runtime one.

    To permanently fix it, focus on the designer’s base‑class requirements and the project’s build settings:

    1. Verify the form’s base class
      • Open the affected .vb file in Code view.
      • Ensure the form class inherits from a designer‑supported base, for example:
             Public Class MyForm
                 Inherits System.Windows.Forms.Form
             End Class
        
      • If it inherits from a custom base form, make sure that base form itself inherits from System.Windows.Forms.Form (or another designer‑supported type) and is in a project that builds successfully.
    2. Ensure the base class is in a buildable, referenced assembly
      • If the base form is in another project, confirm:
        • That project builds without errors.
        • The current project has a reference to that project/assembly.
      • If the base class can’t be loaded, the designer shows errors like “The base class '<class name>' could not be loaded” or “none of the classes within it can be designed.” In that case, rebuild the solution, fix any compile errors, then reopen the designer.
    3. Check platform target for base‑form assemblies
      • Visual Studio is a 32‑bit process and cannot load a base form from a 64‑bit‑only assembly at design time.
      • If the base form (or a library it lives in) is compiled with x64 or Itanium as Platform Target / Target CPU, the designer cannot open inherited forms from it.
      • To fix this permanently:
        • For VB: Project Properties → Compile → Advanced Compile Options → set Target CPU to AnyCPU for the project that defines the base form.
        • For C#: Project Properties → Build → set Platform target to AnyCPU for the project that defines the base form.
      • Rebuild the solution and reopen the form in the designer.
    4. Make sure the form file layout is designer‑friendly
      • Visual Studio requires the designer to use the first class in the file.
      • If the form class is not the first class in the .vb file, move it so it is the first class, then reload the designer.
    5. Use the designer error page to locate code issues
      • When the designer fails, it shows an error page with yellow bars listing the exact file, line, and column of the problem.
      • Use the “jump to location” link in that error page to fix the offending code (for example, invalid identifiers, missing event handlers, or code in InitializeComponent that throws at design time).
    6. General design‑time checks
      • Confirm the class name and identifiers are valid VB identifiers.
      • Ensure there are no circular references (for example, a form creating another instance of itself in InitializeComponent).
      • Make sure the project builds cleanly before opening the designer.

    Once the base form is in an AnyCPU (or otherwise designer‑loadable) assembly, inherits from a designer‑supported type, is the first class in the file, and the project builds without errors, the designer error will stop occurring and forms will no longer need to be recreated.


    References:

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.