Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 29th, 2004, 06:43 PM
Registered User
 
Join Date: May 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.
 
Old May 30th, 2004, 02:47 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Hope it helps

Jacob.
 
Old May 30th, 2004, 08:34 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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
 
Old May 30th, 2004, 02:43 PM
Registered User
 
Join Date: May 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old June 1st, 2004, 08:51 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

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.
 
Old June 3rd, 2004, 01:56 PM
Registered User
 
Join Date: May 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old June 3rd, 2004, 04:05 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.
 
Old June 5th, 2004, 12:25 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

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.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to pull values from dynamic radiobuttons kwilliams ASP.NET 2.0 Professional 0 November 14th, 2008 11:54 AM
DataBinding with Radiobuttons vgsgowrisankar C# 2005 0 May 8th, 2008 05:15 AM
Using Radiobuttons Andrew.Berry ASP.NET 2.0 Professional 6 April 18th, 2008 10:29 AM
Assigning Recordsets mrjeret BOOK: Access 2003 VBA Programmer's Reference 0 July 6th, 2006 09:39 AM





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