The following code example demonstrates how to display a xtd::forms::message_box with the options supported by this overload of xtd::forms::message_box::show. After verifying that a string variable, ServerName, is empty, the example displays a MessageBox, offering the user the option to cancel the operation. If the Show method's return value evaluates to Yes, the form that displayed the MessageBox is closed.
void validate_user_entry() {
// Checks the value of the text.
if (server_name.text().size() == 0) {
// Initializes the variables to pass to the xtd::forms::message_box::show method.
stringmessage = "You did not enter a server name. Cancel this operation?";