I have the following code in a loop which is adding TextBoxes to a Panel. (Note that the first TextBox is intentionally placed in the second slot - to maintain the correct alignment with TextBoxes in an adjacent Panel.)
HeadingCounter += 1
Dim tbxHeading As New TextBox
With tbxHeading
.Text = m.Groups("heading").Value
.Font = tbxModel.Font
.Location = New Point(LeftMargin, YLoc1stHeading + (HeadingCounter * YHeadingsSpacing))
.ReadOnly = True
.Width = HeadingsWidth
.Anchor = AnchorStyles.Left Or AnchorStyles.Right
End With
pnlColHeadings.Controls.Add(tbxHeading)Without the .Anchor= statement the code works as expected - The first TextBox is in the second "slot" and aligned with the second TextBox in an adjacent Panel. BUT with the .Anchor= statement the first two slots in the Panel are empty. I don't see how Left and Right Anchoring is affecting vertical alignment.
Can anyone help me figure out what might be going on?
Thanks, Bob