Results 1 to 4 of 4

Thread: How do you align text in textboxes (left, center, right)

  1. #1
    amakeler is offline VB.NET Forum Newbie
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Dec 2008
    Posts
    7
    Reputation
    0

    How do you align text in textboxes (left, center, right)

    Hi all,

    I am using Visual Basic 2008 Express Edition.

    I have completed a small Windows app. On the way I noticed that I couldn't find a way of aligning the text in my text boxes (in Office VBA, which I know quite well, this would be the TextAlign property, with values TextAlignLeft, TextAlignCenter, and TextAlignRight).

    So I "left" it, and "left" my text all to the "left", when some is supposed to be centered.

    But now I've completed the app, I am going back to fix this, and nowhere can I find a property to align the text in the textbox.

    (Maybe you don't get this property coz Vis Express is free ...?)

    TIA

    - avi

  2. #2
    JohnH's Avatar
    JohnH is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Dec 2005
    Location
    Norway
    Posts
    14,649
    Reputation
    2742
    The Textbox control does have a TextAlign property, you can select values Left/right/Center. You can sort the properties window alphabetical or by category (look in Appearance). VB Express is not limited in this regard.

  3. #3
    amakeler is offline VB.NET Forum Newbie
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Dec 2008
    Posts
    7
    Reputation
    0
    There does not appear a TextAlign property in the Properties pane. I wish there was.
    I have also checked if there is a code field by typing the textbox name, then teh period, and seeing what appears.

    OK, I've found the problem. I was using RichTextBoxes.

    Thanks ...

    -avi

  4. #4
    JohnH's Avatar
    JohnH is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Dec 2005
    Location
    Norway
    Posts
    14,649
    Reputation
    2742
    You probably found this when you figured what control you were actually using, but in case not, for RichTextBox control you can use the SelectionAlignment property to align part or whole of text. This property can't be set in Designer, only in code.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking