radio button question - how to auto uncheck multiple buttons

bones

Well-known member
Joined
Aug 23, 2014
Messages
143
Programming Experience
Beginner
I have 8 radio buttons on a form, each of which triggers various chart series displays. As it stands the user could check on button, display the chart result and then check another and display different chart result. What I'm looking for is some elegant code that basically says...check all the other button states and uncheck them if they are checked when I am checked..

I could use a pile of if, else code for every button but it occurs to me that an experienced programmer may be able to point me to a better way that uses less code...
 
To uncheck all the radio buttons in a group, all you need to do is make one of them True, and then the same one False. For example:

radOne.Checked = True
radOne.Checked = False
 
Never mind..dumb question...I got it... I hate it when I do that..sorry

Thank you for your reply...much appreciated.
What I ended up doing turned out to be relatively easy.

VB.NET:
If CheckBox1.Checked = True Then
            CheckBox2.Checked = False
            CheckBox3.Checked = False
            CheckBox4.Checked = False
            CheckBox5.Checked = False
            CheckBox6.Checked = False
            CheckBox7.Checked = False
            CheckBox8.Checked = False

Then a copy / past for each button's code and change the box# value in one line for that particular checkbox, like this.

VB.NET:
If CheckBox2.Checked = True Then
            CheckBox1.Checked = False
            CheckBox3.Checked = False
            CheckBox4.Checked = False
            CheckBox5.Checked = False
            CheckBox6.Checked = False
            CheckBox7.Checked = False
            CheckBox8.Checked = False
 
Back
Top