p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   C# (http://p2p.wrox.com/forumdisplay.php?f=22)
-   -   Assigning radiobuttons (http://p2p.wrox.com/showthread.php?t=13559)

hydra14 May 29th, 2004 06:43 PM

Assigning radiobuttons
 
How do I assign radiobuttons to groups. Like radiobuttons 1-4 are in one group and you can select only one of the for the answer, and then 5-8 are in another group.

jacob May 30th, 2004 02:47 AM

Try using the name attribute; i.e. same name for all radio buttons in the same group.

Hope it helps

Jacob.

bmains May 30th, 2004 08:34 AM

Hello,

Each ID must be unique for the Radio button. However, there is a GroupName property that groups them together. You can also use a radio button list control, which automatically groups the radio buttons together.

Brian

hydra14 May 30th, 2004 02:43 PM

What is the radio button list control and how do I use it?


melvik June 1st, 2004 08:51 AM

Is it a Web App?!
if so just set GroupName for ur RadioButtonObj.
or if its a HTML tag just set same name for each group!
Why do u make it so difficult?!

Always:),
Hovik Melkomian.

hydra14 June 3rd, 2004 01:56 PM

This isn't a web app. This is just a c# Windows Form.


Imar June 3rd, 2004 04:05 PM

Are you using Visual Studio .NET? Then try this:

1. Drop a Radiobutton control on your form.
2. Make sure it's selected and then press F1.
3. You'll get a list will all members of the RadioButton class.
4. At the top of the page, follow the RadioButton overview link and you'll see this:
Quote:

quote:When the user selects one radio button within a group, the others clear automatically. All RadioButton controls in a given container, such as a Form, constitute a group. To create multiple groups on one form, place each group in its own container, such as a GroupBox or Panel control.
And there you have it. Just add some other containers like Panels on your form. Drag the Radiobuttons into the panel, so all Radiobuttons inside that panel will act as one group. Multiple panels means multiple groups.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.

melvik June 5th, 2004 12:25 AM

What I do for this issue in Win App. is puting a Group-box control on from & then put ur RadioButtons into that Group-box!

HTH.

Always:),
Hovik Melkomian.


All times are GMT -4. The time now is 09:17 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.