I need help aligning text

colossus1958

Member
Joined
Sep 7, 2008
Messages
10
Programming Experience
Beginner
I need help aligning text into columns in a textbox.
I need it to look like the following:
XXXXX XXXXX XXXXX XXXXX
XXXXX XXXXX XXXXX XXXXX
...

I've seen several representations of how to do this in VB6, but I would prefer managed code (VB.net). Also, I want to make sure that what appears in the textbox will translate to the printed page the same way. Any help is appreciated.
 
Alignment in a textbox is quite a bit different than aligning it on a piece of paper.

I would do the code for the TextBox alignment then when it comes to printing do the alignment stuff there because you have different code tools when printing.
 
If you want text in columns then you really shouldn't be using a TextBox at all. There are various controls designed for tabular data, e.g. DataGridView and ListView. If you really must use a TextBox then you might want to look at this:

Formatting Fixed-width Text Output
 
Back
Top