Dr. Greenthumb
Dr. Greenthumb

Reputation: 2316

Right align text inside a TextBox

I would expect there would be a property that I need to set to align the text inside a TextBox, but I can't find it. I remember using [style="text-align:right"] in ASP.net, but what do I use in WinForms?

Upvotes: 6

Views: 26822

Answers (3)

Felipe Oriani
Felipe Oriani

Reputation: 38638

You can change the TextAlign propety using HorizontalAlignment enumerator. Try something like:

textBox1.TextAlign = HorizontalAlignment.Right;

Upvotes: 10

Mark Hall
Mark Hall

Reputation: 54562

Use the Textalign Property. It uses the Horizontal Alignment Enumeration which wil give you Left, Right or Center Alignment.

Upvotes: 3

Related Questions