A message box can be used to communicate with
the user. It can be used to ....
The MsgBox statment displays a message in a box with an OK button and requires
the user to respond to the message box before returning to the form.
To display a message box
MsgBox("Invalid Input")
The box will automatically adjust it's size to fit the message. The text displayed in the title bar of the dialog box will be, by default, the name of the project.
MsgBox("You must provide information for all input fields")
We can pass an argument to the MsgBox statement to display text in the title bar of the message box. Since the Title argument is the third argument we will enter two commas before the string we want to appear. The second argument which we will use later controls the buttons displayed in the message box.
MsgBox("Invalid Input",, "Input Error")
Since the MsgBox statment will take any String passed to it you could pass an expression as in
MsgBox(txtInput.Text & " is not valid Input",, "Input Error")
An alternative way to display a message box is to use the Show method of the MessageBox object. When using the MessageBox object the default title is empty and the title argument is the second argument passed.
MessageBox.Show("Invalid Input")
MessageBox.Show("Invalid Input", "Input Error")
The user must respond to the message box to continue in the program.
We will learn how to handle the other MsgBox and MessageBox arguments at a later time