Textwidth and vbTab

03-02-2005, 04:09 PM
when using textwidth() and vbTab it seems to not count anything to the left of the vbTab, does anybody know why ?

MsgBox TextWidth("123" & vbTab)
MsgBox TextWidth(vbTab & "123")
'both return different

thank you.

03-02-2005, 06:45 PM
What does each one return? Have your tried the Len() function?

03-02-2005, 09:00 PM
I thought about, and tested, this one but finally.. its so simple.. :eek:

Heres, the story.. First TextWidth returns the actual length of the line in the scale of whatever the form is set to, say characters for this example. With that said:

TextWidth("123" & vbTab) returns 5
TextWidth(vbTab & "123") returns 7.25
TextWidth(vbTab) returns 5

To test why, open up notepad (or whatever), type in those, then check out where your cursor is. For the first one, 123 then tab over to 1" say, result 1". For the second one, tab over to 1" then type 123, result 1.3"ish. Lastly just press tab, result 1". Tada! :D

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum