ianlknight
New member
- Joined
- Feb 25, 2009
- Messages
- 2
- Programming Experience
- 10+
Simple question. How do you position controls loaded at runtime to align middle? I'm not looking to match the x y coordinates as the heights vary.
For example loading 2 text boxs and 2 labels.
I've tried using the Anchor and Dock properties but with no joy.
e.g.
txtNewTextBox = New TextBox
txtNewTextBox.Name = "name"
txtNewTextBox.Dock = DockStyle.Fill
txtNewTextBox.Anchor = System.Windows.Forms.AnchorStyles.None
pnlHeader.Controls.Add(txtNewTextBox, 1, 1)
For example loading 2 text boxs and 2 labels.
I've tried using the Anchor and Dock properties but with no joy.
e.g.
txtNewTextBox = New TextBox
txtNewTextBox.Name = "name"
txtNewTextBox.Dock = DockStyle.Fill
txtNewTextBox.Anchor = System.Windows.Forms.AnchorStyles.None
pnlHeader.Controls.Add(txtNewTextBox, 1, 1)