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

  • SEARCH
  • Home
  • 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 8272137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:02:23+00:00 2026-06-08T07:02:23+00:00

I am making a MessageBox like class (MessageBoxCustom). I would like to have a

  • 0

I am making a MessageBox like class (MessageBoxCustom).
I would like to have a Form with designer support in a separate file so I can modify the appearance through Visual Studio (MessageBoxCustomDialog ).

I would also like to make this MessageBoxCustomDialog unreachable by code outside MyMessageBox and I’m nesting MessageBoxCustomDialog. I would like to move it in a separate file so I’d have designer support. Maybe using a partial class? How would the hierarchy go?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace System.Windows.Forms
{
    public static class MessageBoxCustom
    {
        public static void Show()
        {
            (new MessageBoxCustomDialog()).ShowDialog();
        }

        private class MessageBoxCustomDialog : Form
        {

        }
    }
}
  • 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-06-08T07:02:26+00:00Added an answer on June 8, 2026 at 7:02 am

    The Visual Studio Designer can not help you design nested classes. It is just not made for that. It checks the type of the first outermost class in the file and then decides which designer to use.

    If it is just about designing the layout of the form I would recommend to design it as usual. When you finished your project you can then surround the class by the outer class (in both files) and make it private.

    When you finshed your work just copy and paste the dialog class into the outer class and make it private. If you have to rework the design it is again just copy and paste.

    MessageBoxCustomDialog.cs:

    namespace System.Windows.Forms
    {
        // make sure this is the first class in the file (required by designer)
        public partial class MessageBoxCustomDialog : Form
        {
            public MessageBoxCustomDialog()
            {
                InitializeComponent();
            }
        }
    
        public static partial class MessageBoxCustom
        {
            public static void Show()
            {
                new MessageBoxCustomDialog().ShowDialog();
            }
    
            // put the MessageBoxCustomDialog class here when you are done
        }
    }
    

    MessageBoxCustomDialog.Designer.cs:

    namespace System.Windows.Forms
    {
        partial class MessageBoxCustomDialog
        {
            ...
        }
    
        partial class MessageBoxCustom
        {
            // put the MessageBoxCustomDialog class here when you are done
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(WinForms .net 2.0) I'm making a form which, much like the standard MessageBox ,
I'm making a class so I can cheat at minesweeper, and is currently building
I'm making a Class Library and I'm using it inside a Windows Form Program.
I'm making a login form in VB.NET, and I have a table in mysql
I have a small problem. After making a hex mask, I can not copy/paste
Good day! I would like to have your suggestions with regards to this matter.
Making a word document of our network set-up. We have about 7 servers and
I have a boolean function which is used in the decision-making of many other
I'm making a little file splitter-joiner, and I've already got the splitting process done.
I'm making a usercontrol which is a file manager (cut ,copy ,paste .. etc)

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.