|
-
Jun 23rd, 2006, 11:14 PM
#1
Thread Starter
Member
[2.0] Static Length Strings / Aligning text
I'm wanting to align text in a textbox, in columns. I'm using courier new, so every character is equal in width. the easiest way of doing this I imagine is to set my strings to specific-width somehow. If a string is say, less than 20 characters, then fill it with spaces.
Using tabs is also doable, as well.. but requires a bit more work in predicting how many tabs you need to align the data.
i also read somewhere you can set tabstops in a textbox, but i'm not looking for that, as the tabs aren't always going to be in the same area.
The first method i mentioned is probably what i'm looking to do unless there is an easier way. How would i go about doing that?
-
Jun 23rd, 2006, 11:23 PM
#2
Re: [2.0] Static Length Strings / Aligning text
Use the String.PadLeft method. You specify the total number of characters and it will add spaces to achieve that length if required.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|