Link to home
Start Free TrialLog in
Avatar of johnqtr
johnqtr

asked on

Uncheck checkbox when other checkbox is selected

I have three checkboxes:

prodCheck
tankCheck
dateCheck

I have been trying to write some code that will uncheck the other checkboxes that are NOT selected.  I thought that I could just write something like:

If tankCheck.Checked = True Then
    prodCheck.Checked = False
End If

But, that doesn't work.  In other words, you can only have one checkbox selected at a time.
ASKER CERTIFIED SOLUTION
Avatar of softplus
softplus

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Create a single event handler than handles teh events for all 3 check boxes. Then, use this code:

If prodCheck.Checked OrElse tankCheck.Checked then dateCheck.Checked = False
If tankCheck.Checked OrElse dateCheck.Checked then prodCheck.Checked = False
If prodCheck.Checked OrElse dateCheck.Checked then tankCheck.Checked = False
Avatar of YZlat
use RadioButton instead
Avatar of johnqtr
johnqtr

ASKER

Dropdown would be better.  I just didn't think about that.  Thanks!