Manip wrote:
Assuming you don't want a quick and dirty solution - you could also loop though the form controls collection. You have to figure that one out on your own though.
Hmm, I'm not sure If i Would call it dirty... Personally I like the looping better because its more extensible, If i ever add/remove controls at either design time or run time I dont have to wory about handlers.
Here is how I would probably do it:
Dim ctrl As Control
Dim rdo As RadioButton
For Each ctrl In Me.Controls
If TypeOf ctrl Is RadioButton Then
rdo = CType(ctrl, RadioButton)
If rdo.Checked Then
MessageBox.Show(rdo.Text)
End If
End If
Next
Then again, events would be a fun way to do it. Great. Now I'm all conflicted. I suppose in the end the event based model would be slightly faster, especially on a form that is heavy with controls.
In any case, now you have two ways of solving your questio.