I need to change the message box control buttons Yes
to Continue
and No
to Close
. How do I change the button text?
Here is my code:
DialogResult dlgResult = MessageBox.Show("Patterns have been logged successfully", "Logtool", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
Definition. Displays a message window, also known as a dialog box, which presents a message to the user. It is a modal window, blocking other actions in the application until the user closes it. A MessageBox can contain text, buttons, and symbols that inform and instruct the user.
The first button on the message box is the default button.
I didn't think it would be that simple! go to this link: https://www.codeproject.com/Articles/18399/Localizing-System-MessageBox
Download the source. Take the MessageBoxManager.cs file, add it to your project. Now just register it once in your code (for example in the Main() method inside your Program.cs file) and it will work every time you call MessageBox.Show():
MessageBoxManager.OK = "Alright"; MessageBoxManager.Yes = "Yep!"; MessageBoxManager.No = "Nope"; MessageBoxManager.Register();
See this answer for the source code here for MessageBoxManager.cs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With