ARTICLE

Localizable Message Box Control

Posted by g_lazarevic Articles | Windows Controls C# April 02, 2005
This is localizable MessageBox control. Buttons on standard windows message box controls are always Yes, No, Abort, Cancel, OK, Ignore, Retry. I needed different text on my message boxes so I decided to develop custom message box control.
Reader Level:
Download Files:
 

My control is useful for every project. This is localizable MessageBox control. Buttons on standard windows message box controls are always Yes, No, Abort, Cancel, OK, Ignore, Retry. I needed different text on my message boxes so I decided to develop custom message box control. I wrote one Test application just to show how it works. There are 10 predefined constructors.

  • 5 classic like Windows.Forms.MessageBox
    1. public static DialogResult Display(string message,string caption,MessageBoxButtons buttons,MessageBoxIcon icon,MessageBoxDefaultButton defaultButton)
    2. public static DialogResult Display(string message,string caption,MessageBoxButtons buttons,MessageBoxIcon icon)
    3. public static DialogResult Display(string message,string caption,MessageBoxButtons buttons)
    4. public static DialogResult Display(string message,string caption)
    5. public static DialogResult Display(string message)
  • 5 special with predefined text on buttons
    1. public static DialogResult DisplayLocal(string message,string caption,MessageBoxButtons buttons,MessageBoxIcon icon,MessageBoxDefaultButton defaultButton,string yesButtonText,string noButtonText,string abortButtonText)
    2. public static DialogResult DisplayLocal(string message,string caption,MessageBoxButtons buttons,MessageBoxIcon icon,string yesButtonText,string noButtonText,string abortButtonText)
    3. public static DialogResult DisplayLocal(string message,string caption,MessageBoxButtons buttons,string yesButtonText,string noButtonText,string abortButtonText)
    4. public static DialogResult DisplayLocal(string message,string caption,string yesButtonText)
    5. public static DialogResult DisplayLocal(string message,string yesButtonText)

Default text is Serbian Da=Yes, Ne=No and Odustani=Abort.
Dialog result is on of the following:

  • Yes
  • No
  • Cancel

There is no DialogResult.OK, DialogResult.OK, DialogResult.Retry

You can

  • Have maximum 3 buttons
  • Choose one of four Icons (Error, Information, Warning, Question, No icon)
  • Set default button
  • Set text for each button

Here are some screen shots to take a look at:

Example 1:

Example 2:

Login to add your contents and source code to this article
post comment
     

"What's an Amazing Performance"  Thanks a lot for improving my instresting knowledge

Posted by Narendran N Feb 11, 2010
COMMENT USING
PREMIUM SPONSORS
Over-C is a holistic consortium of communications and technology specialists. We build, deploy and market both business as well as consumer products and solutions.
Join a Chapter
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.