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

amakeler

Member
Joined
Dec 23, 2008
Messages
7
Programming Experience
10+
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
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,377
Location
Norway
Programming Experience
10+
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.
 

amakeler

Member
Joined
Dec 23, 2008
Messages
7
Programming Experience
10+
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
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,377
Location
Norway
Programming Experience
10+
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.
 
Top Bottom