Link to home
Start Free TrialLog in
Avatar of kuist
kuist

asked on

Printing string!

Hi!

I'm showing a multiple line textbox so the user can enter a note, I store it into a DB and want to show it back in a label...

but everywhere where the user pressed 'enter' button, it show a little black rectangle and doesn't change line :(

Also, if the sentence is longer than the label's width, It won't automatically change line..

what solution do you suggest for me to go around that?
Avatar of DrDelphi
DrDelphi

Set WordWrap to True on the label. Also, you'll need to insert Chr(13) wherever you have those non-printable characters. This simulates a return. For example:

Label1.Caption = "Dave" + Chr(13) + "was" + Chr(13) + "Here"



Shows on three lines.


Good luck!!
Those non-printable characters are probably from your CR/LF line breaks.  The problem seems to be that the DB is stripping the CR/LFs and possibly converting them into either CRs or LFs.

DrDelphi's probably on track with that, if you can figure out what it converts to, but maybe another way is to put the info back into a different textbox (also with multiline on and maybe borders off to make it look like a label) then set the Locked property so users can't modify the data.
Avatar of kuist

ASKER

drdelphi: well.. could I use something to replace all return by Chr(13) within the string?!
ASKER CERTIFIED SOLUTION
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Acperkins is correct but a more efficient method would be...

sText = Replace(sText,vbLF,"")

This way only the unwanted characters are removed instead of removing both the CR and LF then putting the CR back in.