INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

VB.Net - Windows Forms - Radio Buttons in Different GroupBoxes behaving like one GroupBox

VB.Net - Windows Forms - Radio Buttons in Different GroupBoxes behaving like one GroupBox

VB.Net - Windows Forms - Radio Buttons in Different GroupBoxes behaving like one GroupBox

(OP)
I have a windows form with 2 group boxes. The first groupbox has 3 radio boxes which set an option when the user submits the form and the second groupbox has 2 radio boxes.

When the form loads I can see the default radio button for each groupbox is pre-selected as intended, but as soon as I click a different radio button in the first groupbox all the buttons are un-selected in the second groupbox as well.

I have the radio buttons added to each box:

CODE

me.groupBox5.Controls.Add(me.radioButton4)
me.groupBox5.Controls.Add(me.radioButton5)
me.groupBox5.Name = "groupBox5"
me.groupbox5.Location = New System.Drawing.Point(40, 406)
Me.groupBox5.Size = New System.Drawing.Size(450, 90)
me.groupbox5.Text = "Name Selection"
.
.
.
me.groupBox1.Controls.Add(me.radioButton1)
me.groupBox1.Controls.Add(me.radioButton2)
me.groupBox1.Location = New System.Drawing.Point(190, 20)
me.groupBox1.Size = New System.Drawing.Size(300, 90)
me.groupBox1.Text = "Options" 

So I don't understand why they aren't behaving independently.

Any ideas?

Thanks,
Jeff

RE: VB.Net - Windows Forms - Radio Buttons in Different GroupBoxes behaving like one GroupBox

(OP)
SOLVED

I figured it out after combing through more search results...I was adding the same controls to both the groupbox and the form so the form didn't know which controlled what.

Lesson learned: Add the radiobutton controls to groupbox and then add only the groupbox to the form.

Jeff

RE: VB.Net - Windows Forms - Radio Buttons in Different GroupBoxes behaving like one GroupBox

Wouldn't it be easier to set it all in Design instead of adding controls at Run time?

Have fun.

---- Andy

There is a great need for a sarcasm font.

RE: VB.Net - Windows Forms - Radio Buttons in Different GroupBoxes behaving like one GroupBox

(OP)
Perhaps. But at this point I'm revising someone else's code and it's easier to add to what was done than change things significantly.

Jeff

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close