If CheckBox1.CheckState = CheckState.Checked Then
MsgBox("Checked")
Else
MsgBox("Not Checked")
End If
An alternative to Else is ElseIf. It works like this:
If CheckBox1. CheckState = 1 Then
MsgBox "Checked"
ElseIf Checkbox1. CheckState = 0 Then
MsgBox "Unchecked"
End If
MsgBox("Checked")
Else
MsgBox("Not Checked")
End If
An alternative to Else is ElseIf. It works like this:
If CheckBox1. CheckState = 1 Then
MsgBox "Checked"
ElseIf Checkbox1. CheckState = 0 Then
MsgBox "Unchecked"
End If
Optoin Box
Dim ChosenSitCom As String
If RadioButton1.Checked = True Then
ChosenSitCom = RadioButton1.Text
ElseIf RadioButton2.Checked = True Then
ChosenSitCom = RadioButton2.Text
ElseIf RadioButton3.Checked = True Then
ChosenSitCom = RadioButton3.Text
ElseIf RadioButton4.Checked = True Then
ChosenSitCom = RadioButton4.Text
ElseIf RadioButton5.Checked = True Then
ChosenSitCom = RadioButton5.Text
End If
MsgBox("You voted for " & ChosenSitCom)