Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load ' ' First show a single-argument dialog box with MessageBox.Show. ' MessageBox.Show("Dot Net Perls is awesome.") ' ' Show a two-argument dialog box with this method. ' MessageBox.Show("Dot Net Perls is awesome.", _ "Important Message") ' ' Use a three-argument dialog box with MessageBox.Show. ' ... Also store the result value in a variable slot. ' Dim result1 As DialogResult = MessageBox.Show("Is Dot Net Perls awesome?", _ "Important Question", _ MessageBoxButtons.YesNo) ' ' Use four parameters with the method. ' ... Use the YesNoCancel enumerated constant and the Question icon. ' Dim result2 As DialogResult = MessageBox.Show("Is Dot Net Perls awesome?", _ "Important Query", _ MessageBoxButtons.YesNoCancel, _ MessageBoxIcon.Question) ' ' Use five arguments on the method. ' ... This asks a question and you can test the result using the variable. ' Dim result3 As DialogResult = MessageBox.Show("Is Visual Basic awesome?", _ "The Question", _ MessageBoxButtons.YesNoCancel, _ MessageBoxIcon.Question, _ MessageBoxDefaultButton.Button2) ' ' Use if-statement with dialog result. ' If result1 = DialogResult.Yes And _ result2 = DialogResult.Yes And _ result3 = DialogResult.No Then MessageBox.Show("You answered yes, yes and no.") ' Another dialog. End If ' ' Use MessageBox.Show overload that has seven arguments. ' MessageBox.Show("Dot Net Perls is the best.", _ "Critical Warning", _ MessageBoxButtons.OKCancel, _ MessageBoxIcon.Warning, _ MessageBoxDefaultButton.Button1, _ MessageBoxOptions.RightAlign, _ True) ' ' Show a dialog box with a single button. ' MessageBox.Show("Dot Net Perls is super.", _ "Important Note", _ MessageBoxButtons.OK, _ MessageBoxIcon.Exclamation, _ MessageBoxDefaultButton.Button1) End Sub End Class