Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1446
  • Last Modified:

VB.Net Anchor Layout

Hi,
I have textboxes with labels above them on a panel.  When I install an run the program on a different computer with different resolution, the labels and textboxes no longer are aligned. (They were previously aligned both to the left with the label above the textbox.

Any Ideas what is going on?  Think I have tried every combination of anchoring?

Thanks
0
sublimation
Asked:
sublimation
1 Solution
 
dwopsCommented:
what anchoring does is it maintains the distance between the edge of the control and the edge of the form.  if its anchored to the left and the right, then the control's width will stretch (or contract) to maintain that distance.  If you don't want your control to change width, then don't anchor then to BOTH edges.  

For example if you want your control to be the upper left corner, then anchor them to the top and to the left.  I would recommend this for you.  I you don't want it to align to the left part of the screen, then remove both the left and right anchors, this will allow the  control to maintain its position and not move with the size of the form.

this article covers it pretty well
http://www.imt.net/~joe/matt/program/vb/Tutorials/pflvb7/
0
 
durkinCommented:
You could manually align them with something like:

Textbox1.Left = Label1.Left
Textbox1.Top = Label1.Top + Label1.Height
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now