Occasionally, you as a developer may want to show a textual message to the user of your application. You may even want to ask a question at a strategic point in your code. Message boxes are the standard way of presenting messages to users, and they allow you to ask questions of the user and get their responses. The System.Windows.Forms.MessageBox class is provided as part of the .NET Framework for the exact purpose of informing the user and eliciting user responses.
To show a message to the user, you can call the shared Show method of the System.Windows.Forms.MessageBox class. The following code displays a basic message to the user and Figure 22.19 shows the output of this code:
MessageBox.Show("This is a message.")