Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is an easy way to create a MessageBox with custom button text in Managed C++?

Tags:

c++

I would like to keep the overhead at a minimum. Right now I have:

// Launch a Message Box with advice to the user
DialogResult result = MessageBox::Show("This may take awhile, do you wish to continue?", "Warning", MessageBoxButtons::YesNo, MessageBoxIcon::Exclamation);

// The test will only be launched if the user has selected Yes on the Message Box
if(result == DialogResult::Yes)
{
    // Execute code
}

Unfortunately my client would prefer "Continue" and "Cancel" in place of the default "Yes" and "No" button text. It seems like there should be an easy way to do this.

like image 942
Andrew Dunaway Avatar asked Dec 29 '25 05:12

Andrew Dunaway


1 Answers

You can use "OK" and "Cancel"

By substituting MessageBoxButtons::YesNo with MessageBoxButtons::OKCancel

MessageBoxButtons Enum

Short of that you would have to create a new form, as I don't believe the Enum can be extended.

like image 153
Corin Blaikie Avatar answered Dec 30 '25 18:12

Corin Blaikie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!