An if statement that makes one decision
Public Class Form1
Private Sub btnOne_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOne.Click
If chkCheck.Checked Then
MessageBox.Show("Congrats, You Are Alive")
End If
End Sub
End Class
An if statement where it's either or
Public Class Form1
Private Sub btnOne_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOne.Click
If chkCheck.Checked Then
MessageBox.Show("You Win")
Else
MessageBox.Show("You Lose")
End If
End Sub
End Class
An if statement where many decisions are made
Public Class Form1
Private Sub btnOne_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOne.Click
If chkCheck.Checked Then
MessageBox.Show("You win 1 dollar")
ElseIf chkCheck2.Checked Then
MessageBox.Show("You lose 1 dollar")
ElseIf chkCheck3.Checked Then
MessageBox.Show("You win 2 dollars")
ElseIf chkCheck4.Checked Then
MessageBox.Show("You lose 2 dollars")
End If
End Sub
End Class
A case statement
Public Class Form1
Private Sub btnFeedback_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFeedback.Click
Dim team As String
Dim anwser As String
team = txtYesOrNo.Text
Select Case team
Case "yes"
anwser = "Too Bad"
Case "no"
anwser = "Good Choice"
Case Else
anwser = "Check Your Spelling"
End Select
MsgBox(anwser)
End Sub
End Class
No comments:
Post a Comment