Help with control array positioning
Posted on 2006-05-12
I want these labels to be laid out 'as close together' as would appear pleasing to the eye.
I also don't want them to extend off the side of the form.
Having a bit of trouble with the logic on the second line of labels...
Here's the relevant code
If x = 7 Then 'This is the 'first' of these labels (there are obviously 7 others, but they're static)
intTop = 2665 'The first label's top
intLeft = 280 'The first label's left
intLeft = lblData(x - 1).Left + lblData(x - 1).Width + 100 'Otherwise - add the left & width to 100 to get the 'new' left (this could use some tweaking, I'd wager)
If intLeft > 6500 Then 'If left is 'dangerously' close to the form's edge, then change the 'top' and reset the 'left' (obviously the left would be okay, but though it's 'unlikely' to have more than 2 rows, I want to give the option for at least 3...
intTop = 3065
intLeft = 280
intTop = 2665
intLeft = lblData(x - 1).Left + lblData(x - 1).Width + 100
.Caption = txtData(1).Text
.Width = 1000
.Height = 255
.Top = intTop
.Left = intLeft
.Visible = True