Compartilhar via


Como: Abrir uma Caixa de Mensagem

This example shows how to open a message box.

Exemplo

A message box is a prefabricated modal dialog box for displaying information to users. A message box is opened by calling the static Show method of the MessageBox class. When Show is called, the message is passed using a string parameter. Several overloads of Show allow you to configure how a message box will appear (see MessageBox).

Private Sub showMessageBoxButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
    ' Configure message box
    Dim message As String = "Hello, MessageBox!"
    ' Show message box
    Dim result As MessageBoxResult = MessageBox.Show(message)
End Sub
void showMessageBoxButton_Click(object sender, RoutedEventArgs e) {
  // Configure message box
  string message = "Hello, MessageBox!";
  // Show message box
  MessageBoxResult result = MessageBox.Show(message);
}

Consulte também

Outros recursos

Exemplo de MessageBox