Anoop
Anoop

Reputation: 91

Multi Line TextBox text alignment (C# 2.0)

I have Multi Line TextBox (C# 2.0). I want to display some data as follows.

"Contact Person    : "  + string1 + Environment.NewLine
"Sales Man         : "  + string2 + Environment.NewLine
"Credit Limit      : "  + string3 + Environment.NewLine
"Due days          : "  + string4 + Environment.NewLine

But this code displaying as

Contact Person    :   Person1
Sales Man        :   salesman1
Credit Limit :  50000.00 
Due days       : 20

My problem is I can't align the text. My expected out put,

Contact Person    : Person1
Sales Man         : salesman1
Credit Limit      : 50000.00 
Due days          : 20 

How can I achieve this?

Upvotes: 1

Views: 3434

Answers (2)

Dag
Dag

Reputation: 71

Set the AcceptsTab property of your textBox to true. Then use '\t' in your textlines to tab to the correct position.

Upvotes: 0

Scott Dorman
Scott Dorman

Reputation: 42516

You need to change the font used by the textbox to a monospaced (non-proportional) font, like Courier.

Upvotes: 6

Related Questions