Click here to Skip to main content
15,896,421 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi all,

I need to change the Message Box Buttons Ok and Cancel Text to Update and AddNew?
Is it possible in C#.NET or I need to create a form and customize it?
Kindly help me in this.
Posted
Updated 21-Mar-21 23:10pm

 
Share this answer
 
try this example .
1. Open a new C# Windows Forms project in Visual Studio.

2. Open the Project Menu and then select Add Class.

3. At the bottom of the dialog box change the name of the file from class1.cs to MessageBoxManager.cs, press the Add button and then delete everything from the file that opens up.

4. Download the source code from the Code Project article, find MessageBoxManager.cs and copy and paste the code into the blank MessageBoxManager.cs file in Visual Studio.

5. Now open program.cs from Solution Explorer and change the Main() method so it looks like this:

        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            MessageBoxManager.OK = "Alright";
            MessageBoxManager.Cancel = "Noway";
            MessageBoxManager.Register();
            MessageBox.Show("This is a message...", "Test", MessageBoxButtons.OKCancel);
            Application.Run(new Form1());
            MessageBoxManager.Unregister();
        }

6. Finally, press F5 to start debugging and you should see a MessageBox pop with the custom text on the buttons, followed by a blank form to customize as you like.


see this link..

Localizing System MessageBox[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900