Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

logic using multiple comboboxes/radiobuttons depending on each other 1

Status
Not open for further replies.

lunaclover

Programmer
Joined
Jun 22, 2005
Messages
54
I'm new to vb.net programming - so please resist the urge to attack such an easy target.. : )
Okay! I have about 6-8 different group boxes (depending on the form) filled with about 5-10 radiobuttons each. Also using comboboxes and checkboxes. A button/check selected in any category will subsequently disable certain options in other categories. There's no "true" hierarchy between the categories. My ultimate goal is to assign a nomenclature to each category's selection, combining them together to create a long model number.
But right now I am trying to just disable the appropriate boxes when certain selections are made, the nomenclature will be next. There are really too many to do with just simple if-then statements, because there are thousands of different combinations. What else could I use? I am stuck. (I did try using if-then statements but could only get them to work if I put them under private sub rb1_checkchanged - and then it wouldn't recognize other radiobuttons within that sub. How do I get them on the right 'level' so all controls are recognized, and not have to program it within the click event?)

Am i dubm?

No really, any advice anybody has for tackling this would be so helpful to me.
 
I would come up with a naming scheme. Use the first three letters or something. For exmaple, a "no1" prefix might need to disable all "no2" prefixed controls. Then, create common event handlers for each type of control. For example, have one event handler for all checkboxes. Inside the event handler, examine the first 3 characters in a select case statement. If it is "no1", for example, code a recursive loop to check all controls in the form and all controls in the form's controls to disable all "no2" prefixed controls.
 
Are you asking how to disable/enable all the controls within a group box?

You can either alter the Handles statement to allow many controls to do the same thing
Code:
private sub rb1_CheckChanged(ByVal.....) handles rb1.CheckChanged, rb2.CheckChanged, rb3.Checkchanged
End Sub

Or to loop through all the radiobuttons in a group box you could do this
Code:
For Each r As RadioButton In Me.GroupBox1.Controls
    r.Checked = False
Next


Sweep
...if it works dont f*** with it
...if its f****ed blame someone else
...if its your fault that its f***ed, say and admit nothing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top