anyone help me with checkboxes in VB.NET please

leeland

Diamond Member
Dec 12, 2000
3,659
0
76
i am trying to figure out how to change the check marks in a group of three check boxes

lets say i want to select #1....then i decide i want to select #2 or #3

i want the other check boxes to uncheck when i select a different one...or in otherwords only have one checkbox selected at a time, not all three

here is an example of what i am trying
Private Sub chkPriority_1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles chkPriority_1.KeyDown
If chkPriority_1.Checked = True Then
chkPriority_2.CheckState = chkPriority_2.CheckState.Unchecked
chkPriority_3.CheckState = chkPriority_2.CheckState.Unchecked

End If
End Sub


thanks


any help would be appreciated
 

leeland

Diamond Member
Dec 12, 2000
3,659
0
76
never mind i figured it out

Private Sub chkPriority_1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkPriority_1.Click
If chkPriority_1.Checked = True Then
chkPriority_2.Checked = False
chkPriority_3.Checked = False
End If
End Sub
 

oog

Golden Member
Feb 14, 2002
1,721
0
0
also, you should verify that your code works when the checkbox is changed through other means -- for instance, using the spacebar while the focus is on the control. i don't remember if there is one, but you might look for some kind of _changed event to tie into instead.