Groupboxes and their Radio Buttons
Groupboxes and their Radio Buttons
Groupboxes and their Radio Buttons
Groupboxes and their Radio Buttons
Groupboxes and their Radio Buttons
Groupboxes and their Radio Buttons Groupboxes and their Radio Buttons Groupboxes and their Radio Buttons Groupboxes and their Radio Buttons Groupboxes and their Radio Buttons Groupboxes and their Radio Buttons Groupboxes and their Radio Buttons Groupboxes and their Radio Buttons
Groupboxes and their Radio Buttons Groupboxes and their Radio Buttons
Groupboxes and their Radio Buttons
Go Back  Xtreme Visual Basic Talk > > > Groupboxes and their Radio Buttons


Reply
 
Thread Tools Display Modes
  #1  
Old 01-10-2013, 07:48 AM
txgeekgirl txgeekgirl is offline
Newcomer
 
Join Date: Jan 2013
Posts: 1
Default Groupboxes and their Radio Buttons


I am working with a very large form that had approx 70 groupboxes containing 4-5 radio buttons.

I have found code to pass the name of the groupbox to a function which then looks at the radio buttons and determines which has a value and returns that value.

What I need is a call that triggers immediately after a value is selected and calls that function. I do not want to have that determination at the radio button level but at the groupbox level.

The closest analogy I can come up with is similar to an AfterUpdate similar to that in VBA but do not know in VB what to use.

Any help is appreciated.
Reply With Quote
  #2  
Old 01-10-2013, 02:29 PM
AtmaWeapon's Avatar
AtmaWeaponGroupboxes and their Radio Buttons AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

The answer I want to say would be "Don't have that many controls on one form at the same time." But no one wants to hear that.

It's relatively easy to write a method that recurses into all container controls, seeks radio buttons, and delegates their CheckedChanged event to a common handler. But then you've got the business of identifying which radio button is the one that was clicked. That's a problem that has to be solved.

If I had the requirement that I had to have that many group boxes and radio buttons on one form pressed upon me, the attached project looks something like how I'd tackle it.

RadioGroupBox is a UserControl that consists of a GroupBox and a FlowLayoutPanel. That FlowLayoutPanel will let you add an arbitrary number of radio buttons and get a scrollbar without much fuss. I added a property so you can set the GroupBox's text. When a radio button is added via AddRadioButton(), its CheckedChanged event is handled privately. When that event gets a notification that a new RadioButton is checked, it raises the RadioButtonSelected event. That's how the form will know when any radio button is selected.

The form has two GroupBoxes. It populates them and handles their RadioButtonSelected event. That event knows the box the item came from and the text of the item; any more complicated identification scheme should be easy to implement.

With a bit of work, you could make it so the radio buttons can be added at design time, but in my opinion it'd take far longer to get that working reliably than having your program load the radio buttons (and group boxes) from a text file or some other data store.
Attached Files
File Type: zip GroupBoxRadioDemo.zip (14.9 KB, 1 views)
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
  #3  
Old 01-10-2013, 03:50 PM
Gruff's Avatar
GruffGroupboxes and their Radio Buttons Gruff is offline
Bald Mountain Survivor

Retired Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA - deceased
Posts: 6,440
Default

Welcome to the forum txgeekgirl. Don't forget to read the forum Posting Guidelines.

I think Atma came up with a nice solution for you, but I agree with him as to not using the best solution (70 group boxes with muliple radio buttons each.)

I can't imagine any user wanting to look at a form with that many options.

If you let us know what your program is meant to do perhaps we can offer a better method.
__________________
Burn the land and boil the sea
You can't take the sky from me


~T

Last edited by Gruff; 01-10-2013 at 03:56 PM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Groupboxes and their Radio Buttons
Groupboxes and their Radio Buttons
Groupboxes and their Radio Buttons Groupboxes and their Radio Buttons
Groupboxes and their Radio Buttons
Groupboxes and their Radio Buttons
Groupboxes and their Radio Buttons Groupboxes and their Radio Buttons Groupboxes and their Radio Buttons Groupboxes and their Radio Buttons Groupboxes and their Radio Buttons Groupboxes and their Radio Buttons Groupboxes and their Radio Buttons
Groupboxes and their Radio Buttons
Groupboxes and their Radio Buttons
 
Groupboxes and their Radio Buttons
Groupboxes and their Radio Buttons
 
-->