Question Problem setting Location.Y of a GroupBox

JA12

Member
Joined
Jul 2, 2013
Messages
17
Location
Ireland
Programming Experience
10+
I'm dynamically generating a form using a basic 1 page TabControl.

The TabPage is blank. Up to two GroupBoxes are added to the TabPage, when more "Columns" are needed, then a new TabPage is added.

I've got a problem. No matter what I do, whether I use isolating 2 Panel/ScrollingControl controls on the TabPage or just the TabPage, when I try to add two groups to the control as side-by-side boxes, the Location.Y value is ALWAYS greater than the bottom of the box to the left.

I define the X,Y co-ordinates as:

VB.NET:
Box 1 - Location: X=0,Y=0    Size: Height=218
 Box 2 - Location: X=400,Y=0

but the Box 2 Y value after the TabPage.Controls.Add(GroupBox) gets set to 228.

I've been trying to find out how to set the Location.Height.MaxValue but this seems to be a ReadOnly property.

How can I stop this happening to the Y value of the GroupBox location?

If there are any other container type controls I can use that don't do this, I'll take any suggestions....
 
Last edited:
Hi,

You are going to have to show us the code that you are using since I am not able to replicate this with the following simple code:-

VB.NET:
Dim GB1 As New GroupBox With {.Location = New Point(0, 0), .Height = 218}
TabControl1.TabPages(0).Controls.Add(GB1)
 
Dim GB2 As New GroupBox With {.Location = New Point(400, 0)}
TabControl1.TabPages(0).Controls.Add(GB2)

Cheers,

Ian
 
I've given up trying to use the GroupBox control as a container, I've wasted too much time on it. I've converted it all to TableLayoutPanel and filled the cells. I've now got it to look how I want it.
 
Back
Top