Setting position on Groupbox

sethindeed

Centurion
Joined
Dec 31, 1969
Messages
118
Location
Montreal Canada
When I want to set the left, top, height, width property on a form, I can easily do it.
However, I noticed that when a control is on a groupbox, it takes the dimension of the groupbox to define these properties.

example : Label1 on a groupbox at the far right will have the left property set to 10.

How do I refer to the groupbox when I set the location at runtime ?

thx
 
When you set positions of controls, you are _always_ referring to the bounds within the parent. If you set the .Left property of a Label within a Groupbox, then that coordinate will be relative to the left-hand side of the groupbox.
 
OK but suppose that I load all my controls at runtime.
My label does not know that I am about to put it on a groupbox.
Is there a way to add a control to a groupbox ?
 
try this...
Visual Basic:
GroupBox1.Controls.Add(Label1)
And then if you get/set the Left of the Label it will be in relation to the Groupbox (As Divil said)
 
Back
Top