RadioBoutton as a group
-
Hi all, I have three radio buttons in a GroupBox. I want to find the selected radio button there. I've done the following.
int _select; if(rb1.Checked) _select = 0;
and so on. Seems it's not a good practice at all, say I have 10 radio buttons. Can someone suggest a better way to do this. ThanksI appreciate your help all the time... CodingLover :)
-
Hi all, I have three radio buttons in a GroupBox. I want to find the selected radio button there. I've done the following.
int _select; if(rb1.Checked) _select = 0;
and so on. Seems it's not a good practice at all, say I have 10 radio buttons. Can someone suggest a better way to do this. ThanksI appreciate your help all the time... CodingLover :)
use RadioButton class as array and use ".Checked" accordingly with every radionbutton instance in a loop. e.g after creating array instance if(radioButton[i].Checked) _select=0;
Thanks, Chintan(India)
-
Hi all, I have three radio buttons in a GroupBox. I want to find the selected radio button there. I've done the following.
int _select; if(rb1.Checked) _select = 0;
and so on. Seems it's not a good practice at all, say I have 10 radio buttons. Can someone suggest a better way to do this. ThanksI appreciate your help all the time... CodingLover :)
AFAIK, Windows forms don't have a
RadioButtonList
control. So I think there is no better way than what you are doing.Navaneeth How to use google | Ask smart questions
-
AFAIK, Windows forms don't have a
RadioButtonList
control. So I think there is no better way than what you are doing.Navaneeth How to use google | Ask smart questions
How about that way that Chintan.Desai talking. I'll give a try and seems it's working fine.
I appreciate your help all the time... CodingLover :)
-
How about that way that Chintan.Desai talking. I'll give a try and seems it's working fine.
I appreciate your help all the time... CodingLover :)
If the radiobuttons are in a groupbox, then use
GroupBox.Controls
property to loop through.C isn't that hard: void (*(*f[])())() defines f as an array of unspecified size, of pointers to functions that return pointers to functions that return void "Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live." - Martin Golding
-
How about that way that Chintan.Desai talking. I'll give a try and seems it's working fine.
I appreciate your help all the time... CodingLover :)
That is OK. But AFAIK, you won't get design time support for control arrays in C#. You need to edit the designer generated code to make the radio buttons in an array or write your own code to add it to the form.
Navaneeth How to use google | Ask smart questions
-
If the radiobuttons are in a groupbox, then use
GroupBox.Controls
property to loop through.C isn't that hard: void (*(*f[])())() defines f as an array of unspecified size, of pointers to functions that return pointers to functions that return void "Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live." - Martin Golding