Radio button GroupName property

  • Thread starter Thread starter SamSpade
  • Start date Start date
S

SamSpade

FOR WINDOWS FORMS

I've been setting all Radio buttons in a group to Checked=False except the
clicked one which I set to True.

I just noticed the GroupName property and if I understand the doc it will do
that for me automatically. Is that correct?


I would not post for the above (I could just try). The reason for this post
is:

If a group of buttons have the same GroupName and I want, say, the Text
property of the checked one - how do I get it?

Also, I don't set the GroupName in the property listing of a Radio Button.
Is it only for Web controls?

If so, are there any short-cuts for Windows?

Thanks
 
REVISED - I got confused with CheckBoxes

If a group of buttons are in the same GroupBox and I want, say, the Text
property of the checked one - how do I get it?

Also, I don't set the GroupName in the property listing of a Radio Button.
Is it only for Web controls?

If so, are there any short-cuts for accessing a checked button property for
Windows?

Thanks
 
* " SamSpade said:
FOR WINDOWS FORMS

I've been setting all Radio buttons in a group to Checked=False except the
clicked one which I set to True.

I just noticed the GroupName property and if I understand the doc it will do
that for me automatically. Is that correct?


I would not post for the above (I could just try). The reason for this post
is:

If a group of buttons have the same GroupName and I want, say, the Text
property of the checked one - how do I get it?

Also, I don't set the GroupName in the property listing of a Radio Button.
Is it only for Web controls?

Add all of the radio buttons to a groupbox. Then add a common handler
to the radio buttons' 'CheckedChanged' event using 'AddHandler'. In the
handler, you set a private variable of type string to
'DirectCast(sender, RadioButton).Name'.
 
Thanks, works great


Herfried K. Wagner said:
Add all of the radio buttons to a groupbox. Then add a common handler
to the radio buttons' 'CheckedChanged' event using 'AddHandler'. In the
handler, you set a private variable of type string to
'DirectCast(sender, RadioButton).Name'.
 
Back
Top