ARTICLE

Localizable Message Box Control using VB.NET

Posted by g_lazarevic Articles | Visual Basic 2010 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.
Download Files:
 
Reader Level:

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 Shared Function Display(message As String, caption As String, buttons As   MessageBoxButtons, icon As MessageBoxIcon, defaultButton As MessageBoxDefaultButton) As DialogResult
    End Function 'Display

  2. Public Shared Function Display(message As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButton As MessageBoxDefaultButton) As DialogResult
    End Function 'Display

  3. Public Shared Function Display(message As String, caption As String, buttons As MessageBoxButtons) As DialogResult
    End Function 'Display

  4. Public Shared Function Display(message As String, caption As String) As DialogResult End Function 'Display

  5.  Public Shared Function Display(message As String) As DialogResult
    End Function 'Display

5 special with predefined text on buttons.

  1. Public Shared Function DisplayLocal(message As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButton As MessageBoxDefaultButton, yesButtonText As String, noButtonText As String, abortButtonText As String) As DialogResult
    End Function 'DisplayLocal

  2. Public Shared Function DisplayLocal(message As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, yesButtonText As String, noButtonText As String, abortButtonText As String) As DialogResult End Function 'DisplayLocal

  3. Public Shared Function DisplayLocal(message As String, caption As String, buttons As MessageBoxButtons, yesButtonText As String, noButtonText As String, abortButtonText As String) As DialogResult
    End Function 'DisplayLocal

  4. Public Shared Function DisplayLocal(message As String, caption As String, yesButtonText As String) As DialogResult
    End Function 'DisplayLocal

  5. Public Shared Function DisplayLocal(message As String, yesButtonText As String) As DialogResult
    End Function 'DisplayLocal

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

  1. Yes
  2. No
  3. 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:

LocalizableMessageBox1.gif

Example 2:

LocalizableMessageBox2.gif


NOTE: THIS ARTICLE IS CONVERTED FROM C# TO VB.NET USING A CONVERSION TOOL. ORIGINAL ARTICLE CAN BE FOUND ON C# CORNER (WWW.C-SHARPCORNER.COM).

share this article :
post comment
 

it work great

Posted by tuan_l May 07, 2010

Great custom messagebox, but the source code is not complete and does not work. The included .dll for the control works, but if you delete it and try to change the code you will realize that it isn't complete. Maybe something was lost in the C conversion?! Otherwise a nice control - thanks!

Posted by Alexi Anastasio Oct 23, 2007
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Nevron Diagram
Become a Sponsor