Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / September 2004

Tip: Looking for answers? Try searching our database.

Newbie: Aligning Labels and TextBoxes on form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sal Bompensaro - 23 Sep 2004 20:24 GMT
Hi,

   When I design forms, I frequently have a lower-right aligned Label to
the left of a TextBox. For example, I might have a Label with the Text
property set to "Name:" and a TextBox to the immediate right where the user
types his name. It's very hard to get the bottom of the label to align with
the bottom of the text box. I discovered that VS.NET will perform the
alignment for me if I select both items and use Format | Align | Bottoms.

   When dealing with long forms containing dozens of Label-TextBox pairs, I
run into problems when I try to select ALL of the controls and, for example,
move them all down an inch or two. I might do this if I realize that I
forgot to include a particular label-textBox pair at the top of the form.
When I move everything down (or up), I lose my alignment. The Labels and
TextBoxes no longer have aligned bottoms. They are close, but not a match.
This means I have to re-select each of the pairs and align them one by one
EACH and every time I decide to change the form in a way that moves these
pairs around. This is getting frustration for me.

   Is this a bug? Is there a workaround? Thanks.

Sal B.
Witness Protection Program ID#19730127
kishore babu tanety - 24 Sep 2004 07:43 GMT
Hi Sal, You can call this bug in one way. However the work around is pretty
simple and straight forward.
1.    Set the form’s grid size to some EVEN number. (Ex: 2,2 or 4,4 or 8,8)
2.    Set the height of the Label and the textbox to EVEN numbers value as
well.  (By default Visual Studio sets the size of a label to 100,23 and the
size of the text box to 100,20.)
That all you will need to do. You are good to go!!

Needless to explain, you must have understood the core of the issue now.

BTW, If you don’t want to change the size if the components, do a select all
and move them around by drag and drop. (USE THE MOUSE, DON’T USE THE ARROW
BUTTONS)

-KISHORE BABU TANETY

> Hi,
>
[quoted text clipped - 19 lines]
> Sal B.
> Witness Protection Program ID#19730127
Sal Bompensaro - 24 Sep 2004 16:01 GMT
> Hi Sal, You can call this bug in one way. However the work around is pretty
> simple and straight forward.
[quoted text clipped - 3 lines]
> size of the text box to 100,20.)
> That all you will need to do. You are good to go!!

   I can't seem to make your solution work. Consider:

   - Create a new WinForms project. The default size of the form is 300x300
[even numbers].

   - Drag a label on to the form. Set it's height to 16. Set it's TextAlign
property to BottomRight.

   - Drag a text box on the form and place it to the right of the label.

   - Holding the control key, select first the TextBox and then the Label.
Select Format | Align | Bottoms. The two controls are now aligned properly.

   - Select both controls and drag them with the mouse down a few inches.
The controls are no longer aligned properly... That's basically my problem.

Sal
kishore babu tanety - 27 Sep 2004 06:05 GMT
Ooops, I think you miss read my sentance. Or may be i should have framed my
sentance better.
I was not mentioning the size of the frame, but I was mentioning the
Gridsize. I have checked it again and it works Sal.

> > Hi Sal, You can call this bug in one way. However the work around is
> pretty
[quoted text clipped - 23 lines]
>
> Sal
Sal Bompensaro - 27 Sep 2004 21:53 GMT
> Ooops, I think you miss read my sentance.

   Yes, I did. Sorry about that... thanks for the help.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.