String.Format used to make columns

  • Thread starter Thread starter **Developer**
  • Start date Start date
D

**Developer**

ControlRichTextBox1.SelectedText = String.Format("{0} {1}", strExt,
x.szTypeName) & vbCrLf



Three questions:

1) How can I insert a tab between {0} and (1} so the richtextbox tabs
x.szTypeName into a nice column?

2) How can I insert spaces so as to line up x.szTypeName into a nice column?

3) Is there a better way?



Thanks
 
**Developer** said:
ControlRichTextBox1.SelectedText = String.Format("{0} {1}", strExt,
x.szTypeName) & vbCrLf



Three questions:

1) How can I insert a tab between {0} and (1} so the richtextbox tabs
x.szTypeName into a nice column?

2) How can I insert spaces so as to line up x.szTypeName into a nice
column?

3) Is there a better way?



Thanks

Dim s As String = String.Format("{0,-20} {1}", param1, param2)

That will give you spaces...

Mythran
 
| 1) How can I insert a tab between {0} and (1} so the richtextbox tabs
| x.szTypeName into a nice column?

help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemDrawingStringFormatClassSetTabStopsTopic.htm

| 2) How can I insert spaces so as to line up x.szTypeName into a nice
column?

this is a less-than-useful way to go as non-fixed-width fonts line up
differently.

| 3) Is there a better way?

see reference to question 1.
 
Better than what I had but the column is ragged. Probably need to use tabs
to get it perfect.

Thanks
 
**Developer** said:
Better than what I had but the column is ragged. Probably need to use tabs
to get it perfect.

Thanks


As <unprintablecharacter> stated, the columns won't line up if you are not
using a fixed-width font. Tabs may not work either (example as follows):

1234 HERE
123456789 HERE



Mythran
 
Thanks
Mythran said:
As <unprintablecharacter> stated, the columns won't line up if you are not
using a fixed-width font. Tabs may not work either (example as follows):

1234 HERE
123456789 HERE



Mythran
 
help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemDrawingStringFormatClassSetTabStopsTopic.htm
How do I use this?

I tried pasting it into IE (got page can not be displayed)

and also into VS Help without finding it.

I did use Google and found it but I expect there is a better way.


Thanks
 
sorry...open the vs.net ide, then click the help menu and select
search...from there, search on settabstops.

that should get you there.
 
Thanks a lot.

I had found it in help but you gave what I think is a URL that should have
found it for me and I wondered why it didn't work for me.

thanks again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top