Hi all,

New user here using VB .Net 2008

I seem to be having trouble getting group boxes to appear when I click a radio button.

For example:

If radiobutton1.Checked Then
            Groupbox1.Visible = True
            Groupbox2.Visible = False
            Groupbox3.Visible = False
            Groupbox4.Visible = False
        End If

This indeed brings up the first radio button however I have other groupboxes underneath which with the same code will not appear when the radio button is checked.

Eg:

If radiobutton2.Checked Then
            Groupbox2.Visible = True
            Groupbox1.Visible = False
            Groupbox3.Visible = False
            Groupbox4.Visible = False
        End If

The second groupbox does not appear and is directly behind the first groupbox.

The

.Top

code doesn't seem to be working either.

If anyone could shed some light on this I would really appreciate it.

Thanks!

It sounds as if, the groupboxes 2-4 are contained within the first groupbox container... If you move groubbox1 around on the form, does all the other groupboxes move with it?

Hi Tom,

I got this fixed earlier. You are right, they were merging together. I found it quite difficult to fix as they kept linking so I had to put the group boxes slightly out of order to fix this which I am not happy with but it seems to be the only solution.

Thanks again

Without using the mouse to move the group boxes, assign them all the same location in the properties window. This will position them on top of each other and should prevent them from becoming a child control.

Thanks Tom!

or you can put it in the code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.