Typical Info Message Box


	MessageBox::Show(L"Message Text", L"Message Box Title", MessageBoxButtons::OK, MessageBoxIcon::Information);

Typical Error Message Box


//1st string is message, 2nd string is box title.  Here's a classic error message usage:
catch (Exception^ e)
{
	MessageBox::Show(L"Comms Failed with the following error:\n" + e, L"Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
}

Exclamation Error Box


MessageBox::Show(L"You can't do this", L"Not Possible", MessageBoxButtons::OK, MessageBoxIcon::Asterisk);

Select OK To Continue Message Box


if (
	MessageBox::Show(
				L"Are you sure you want to do this?",
				L"Continue?",
				MessageBoxButtons::YesNo,
				MessageBoxIcon::Exclamation
				) == System::Windows::Forms::DialogResult::Yes)
{

Message Box – Dealing With Multiple Options


	System::Windows::Forms::DialogResult Result;
	Result = MessageBox::Show(
					L"Would you like to save changes to the current settings and layout?",
					L"Save Changes?",
					MessageBoxButtons::YesNoCancel,
					MessageBoxIcon::Exclamation);
	if (Result == System::Windows::Forms::DialogResult::Cancel)
	{
		return(false);
	}
	else if (Result == System::Windows::Forms::DialogResult::Yes)
	{
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published. Required fields are marked *