Creating a Custom Message Box in C#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jason Dielman
    New Member
    • Sep 2010
    • 2

    #1

    Creating a Custom Message Box in C#

    I am trying to create a custom MessageBox (which for now I've "cleverly" named MyMessageBox). I have downloaded a new toolkit containing new namespaces which allow me to easily create a "preloaded" custom form... so rather than using System.Windows. Forms; I create a reference to the other reference. So far I've created the new class and have defined the Show method for MyMessageBox. I simply created the class and inherited the other tool kit's form as such...

    Code:
    using TheNewToolkitNameSpace;
    
          public partial class MyMessageBox : TheNewToolkitNameSpaceForm
        {
            public MyMessageBox()
            {
                InitializeComponent();
            }
            public void Show(string message, string title)
            {
                this.message = [I][B]"Trying to figure out the
                                easiest way to display the
                                text in the form without
                                using a label control."[/B][/I]
                this.Text = title;
                this.Show();
            }
            public void Show(string message, string title, MessageBoxButtons buttons)
            {
                //Haven't thought about the buttons just yet;
                //Though about just using this.Control.Add
                //and setting the values. Perhaps create a
                //sub method to handle that and call it when
                //needed.
                this.Show();
            }
    "this.messa ge" is what I'm trying to figure out... How to display the text in my custom form as the standard message box does.

    Go easy on me... I've not been coding but for a couple months.

    Any suggestions?

    Thanks
    Last edited by Jason Dielman; Sep 5 '10, 04:36 AM. Reason: Code Structure
  • Christian Binder
    Recognized Expert New Member
    • Jan 2008
    • 218

    #2
    I think you should put a Label on your Form, maybe with Dock = DockStyle.Fille d and set the Labels's Text property to your message.

    Comment

    Working...