Using MessageBox.
Show function
First here we look at an event handler in the [Link] language that will show the message boxes in the screenshot sequentially when
the program executes. The [Link] function is a Public Shared Function type in the [Link] language and it can be called
without an instance reference. You can invoke [Link] directly. The method receives different numbers of parameters, and
by specifying certain arguments and the right number of arguments, you can get the desired dialog box.
Public Class Form1
Private Sub Form1_Load(ByVal sender As [Link], _
ByVal e As [Link]) Handles [Link]
'
' First show a single-argument dialog box with [Link].
'
[Link]("Dot Net Perls is awesome.")
'
' Show a two-argument dialog box with this method.
'
[Link]("Dot Net Perls is awesome.", _
"Important Message")
'
' Use a three-argument dialog box with [Link].
' ... Also store the result value in a variable slot.
'
Dim result1 As DialogResult = [Link]("Is Dot Net Perls awesome?", _
"Important Question", _
[Link])
'
' Use four parameters with the method.
' ... Use the YesNoCancel enumerated constant and the Question icon.
'
Dim result2 As DialogResult = [Link]("Is Dot Net Perls awesome?", _
"Important Query", _
[Link], _
[Link])
'
' Use five arguments on the method.
' ... This asks a question and you can test the result using the variable.
'
Dim result3 As DialogResult = [Link]("Is Visual Basic awesome?", _
"The Question", _
[Link], _
[Link], _
MessageBoxDefaultButton.Button2)
'
' Use if-statement with dialog result.
'
If result1 = [Link] And _
result2 = [Link] And _
result3 = [Link] Then
[Link]("You answered yes, yes and no.") ' Another dialog.
End If
'
' Use [Link] overload that has seven arguments.
'
[Link]("Dot Net Perls is the best.", _
"Critical Warning", _
[Link], _
[Link], _
MessageBoxDefaultButton.Button1, _
[Link], _
True)
'
' Show a dialog box with a single button.
'
[Link]("Dot Net Perls is super.", _
"Important Note", _
[Link], _
[Link], _
MessageBoxDefaultButton.Button1)
End Sub
End Class