Hello,
I'm working on a project with radio buttons. It includes 12 radio buttons and before I run the program I need to verify that one of the buttons is selected. Is there an easy way of doing this?
Hello,
I'm working on a project with radio buttons. It includes 12 radio buttons and before I run the program I need to verify that one of the buttons is selected. Is there an easy way of doing this?
Below is what I did, anyone has any other suggestions?
Code:private void RadioSelected() { if (!(this.radioButton1.Checked || this.radioButton2.Checked || this.radioButton3.Checked || this.radioButton4.Checked || this.radioButton5.Checked || this.radioButton6.Checked || this.radioButton7.Checked || this.radioButton8.Checked)) { MessageBox.Show("Select at least one RadioButton"); return; } }
what GUI toolkit are you using? WPF? WinForms? something else?
What can this strange device be?
When I touch it, it gives forth a sound
It's got wires that vibrate and give music
What can this thing be that I found?
I usually initialize one of every set of radio buttons as selected. Barring strangeness like the code directly clearing the radio button, it shouldn't from then be possible to deselect all buttons.
You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.
Bind the radio buttons (2 state?) to Boolean properties in your class. Check the boolean property to see if the radio button is selected.