A message box is a dialog box that is used to display an alert or a message. A message box can have a title and multiple options such as Yes/No or OK/Cancel. A message box can also have some input control to take input from a user.
The MessageBox class in WPF represents a modal message box dialog, which is defined in the System.Windows namespace. The Show static method of the MessageBox is the only method that is used to display a message box. The Show method returns a MessageBoxResult enumeration that has values OK, Cancel, Yes, and No. We can use MessageBoxResult to find out what button was clicked on a MessageBox and take an appropriate action.
The following code snippet creates a MessageBox with a message, a title, and two OK and Cancel buttons.
MessageBoxResult result = MessageBox.Show("Are you sure you want to delete this Deposit?","Delete", MessageBoxButton.OKCancel);if (result == MessageBoxResult.OK){// do if your result is OK}else{// do if result is cancel}
Hope this help
No comments:
Post a Comment