lunaclover
Programmer
- Jun 22, 2005
- 54
Hi - what in the world is wrong with this code?
Here's what is supposed to happen. When a user chooses a certain option from a combobox, and the clicks on chkBox1, a message box is supposed to come up to validate it.. it comes up when it is checked, but when I click no, or yes, it doesn't care. Here's my code.
Private Sub chkPressure_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkPressure.CheckedChanged
If chkBox1.CheckState.Checked And combobox.Text.Equals("Choice 1") Or combobox.Text.Equals("Choice 2") Then
Dim intReturnValue As Integer
If chkPressure.Checked = True Then
MsgBox("Blah blah blah. Do you still want this option?", MsgBoxStyle.YesNo + MsgBoxStyle.Information + MsgBoxStyle.SystemModal, "Message Box")
If (intReturnValue = MsgBoxResult.No) Then
chkBox1.Checked = False
End If
End If
End If
End Sub
It's supposed to uncheck it if the user says, "No" (i.e. I don't still want this option). Instead it just stays checked.
What gives?
Here's what is supposed to happen. When a user chooses a certain option from a combobox, and the clicks on chkBox1, a message box is supposed to come up to validate it.. it comes up when it is checked, but when I click no, or yes, it doesn't care. Here's my code.
Private Sub chkPressure_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkPressure.CheckedChanged
If chkBox1.CheckState.Checked And combobox.Text.Equals("Choice 1") Or combobox.Text.Equals("Choice 2") Then
Dim intReturnValue As Integer
If chkPressure.Checked = True Then
MsgBox("Blah blah blah. Do you still want this option?", MsgBoxStyle.YesNo + MsgBoxStyle.Information + MsgBoxStyle.SystemModal, "Message Box")
If (intReturnValue = MsgBoxResult.No) Then
chkBox1.Checked = False
End If
End If
End If
End Sub
It's supposed to uncheck it if the user says, "No" (i.e. I don't still want this option). Instead it just stays checked.
What gives?