Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Putting Tabs into a string?? 3

Status
Not open for further replies.

ftpdoo

Programmer
Aug 9, 2001
202
GB
Hi

I have a string which contains a value as can be seen below. The problem occurs when different length of "strType" is enter and thus messes up my alignment of "strDesc"!

Code ==========================================================
strString = "" & strType & " (" & strDesc & ")"
==========================================================

So strString displays the following:

Type (PK12321)
Typedddddd (PK12321)
Typeddd (PK12321)

HOW COULD I KEEP THE TEXT IN THE BACKETS LEVEL?? Is it possible to add a tab???

Thankx,
Jonathan
 
Try using:

strString = "" & strType & chr(9) & " (" & strDesc & ")"

But if you want to show the results on HTML the TAB will be replaced for just one space.

I think you can resolve this printing out the results in a table.
 
Hummm... Still having Problem???

I've tried the following:

===========================================
Dim intLength As Integer
Dim intLength2Add As Integer

intLength = Len(pfType)
intLength2Add = 30 - intLength

strSPACES = String(intLength2Add, " ")
===========================================

to put in the exact number of spaces required?? But the items are still not aligned...

Any idea's??
Jonathan
 
Doesnt matter how many spaces you included in the string always will show just one.

I still thinking on use a table.

 
You can replace the space for   (non-breaking space) but if you do so, you have to use Courier as a font type.

 
Instead of Chr(9), you could use the VB constant vbTab. It makes it a little easier to read your code.
 
I read somewhere about using TextWidth method to determine width of a given piece of text then using a calculated width graphics object to pad out the line before the next bit of text. I think it was in Word but cannot remember the details. :-(

M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top