How to: Display Message Boxes
A MessageBox is a predefined dialog box that displays application-related information to the user. Message boxes are also used to request information from the user.
C++
Code:
public:
void PerformCalculations()
{
// Code is entered here that performs a calculation
// Display a message box informing the user that the calculations
// are complete
MessageBox::Show("The calculations are complete",
"My Application", MessageBoxButtons::OKCancel,
MessageBoxIcon::Asterisk);
}
Message boxes can also receive input. The Show method of the MessageBox class returns a value that can be used to determine a choice made by the user.
Code:
public:
void ExitApplication()
{
// Display a message box asking users if they
// want to exit the application.
if (MessageBox::Show("Do you want to exit?",
"My Application", MessageBoxButtons::YesNo,
MessageBoxIcon::Question) == DialogResult::Yes)
{
Application::Exit();
}
}
http://msdn.microsoft.com/en-us/libr...ow(VS.71).aspx
Bookmarks