Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all ,

i am making a program in vb.net where i have a big number of radio buttons since the system is a customer satisfaction system where i must enter the answers of the customer.So should i make if statements on every radio button to see if it is checked or is there any other way since if i wrote if statements for every radio button then this will take a lot of time ?

Thanks in advance.
Posted

Well, you don't have to write IF statements for every radio button. You could just group related radios together, handle the Click or CheckChanged events and handle the changes accordingly. A single event handler can handle multiple readio buttons. You can modify your backing values when the user makes the changes instead of when the user clicks OK to submit them all.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 18-May-11 14:24pm    
Dave, you're right, my 5, but it also looks like a UI design problem.
Please see my answer.
--SA
Dave Kreskowiak 18-May-11 15:37pm    
Yeah, it is. I didn't feel much like preaching today. In either case, the handling of the radio buttons really doesn't change, not matter how many are on the form.
Sergey Alexandrovich Kryukov 18-May-11 18:04pm    
Surely.
--SA
Ed Nutting 18-May-11 15:01pm    
Good answer, my 5 :)
Dave is right.

Additionally, too many radio buttons is indicative of a bad UI design. You could use drop-down ComboBox instead of a set of radio buttons, or subdivide you form in smaller containers (such as tabs) to show less controls at a time. If the user see to many controls at a time, it's already not management. You should think about user's convenience as well, not just about your own.

This my advice is one of the few advices on UI design I listed before. Please see my answer to this question:
GUI Apperance - C#.Net[^].

—SA
 
Share this answer
 
Comments
Ed Nutting 18-May-11 15:01pm    
Very good answers (inc. ones on your link), my 5's on all of them :)
Sergey Alexandrovich Kryukov 18-May-11 18:02pm    
Thank you, Ed.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900