When I debug my program or send a string to a text box, I am not seeing Ascii characters such as chr(13) & chr(10), (vbCRLF)this appears to be PC biased, on different systems I get either | or a square which is usefull, why am I not seeing them on my laptop.
It depends on what is being used to display the string. The VB6 command window uses a variant of the textbox, and will interpret CRLF as a carriage-return line-feed combination, and move the caret to the next line.
If you need to see these values, convert the string to hexadecimal before displaying it.
Chip H.
____________________________________________________________________
Donate to Katrina relief:
if I run this same program on two of my PC's both with VB6 and SP6 one of them performs the CR and LF whilst the other displays ||, I do not understand why there is any difference, I can see that it is not the VB but must be some language setting on the PC's but as far as I can see they are identical, it is not only the text box if I set a break point on the text1 line and put my cursor on Ad$ I still get the same results as would be displayed in their text boxes, ie one of them shows me that the value for Ad$="||". but the other Ad$="".
No because when I look at the variable in debug mode I get the same results, and if I print to the immediate window, this again gives me the same results by performing the CrLf on one PC but displaying as characters on another.
The VB6 instrinsic function MsgBox interprets Lf, Cr, CrLf, or LfCr all as "newline" symbols.
A multiline instrinsic Textbox control interprets CrLf as newline, but has no idea what you mean by LfCr and thus will display a pair of "default" symbols, which look something like "|" in many fonts. CrLf will give a similar pair of default symbols in a Textbox where Multiline = False.
In your second post here you use Chr(10) & Chr(13), which yields a variant string LfCr.
This serves once again to show why there is nothing 'leet about using the Chr/Chr$ functions where they aren't warranted and why the practice should be avoided.
When you want a newline in VB6 you should be using the intrinsic constant vbNewLine (which in Windows VB/VBA is equal to the constant vbCrLf). That's why it exists, to help programmers avoid such errors and to help others understand the original programmer's intent.
One is sometimes reminded of Obi Wan's advice to young Luke: "Dude, stop fighting it.
Sorry a slip up in the typing, It is the same piece of code on both pc's and it doesnt matter if I put vbCrLf or chr(10)& chr(13) the outcome is the same, all pc's are running XP pro with sp2 on.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.