Solved

Printing string!

Posted on 2002-07-16
5
116 Views
Last Modified: 2010-05-02
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?
0
Comment
Question by:kuist
5 Comments
 
LVL 6

Expert Comment

by:DrDelphi
ID: 7158405
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!!
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 7158415
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.
0
 

Author Comment

by:kuist
ID: 7158429
drdelphi: well.. could I use something to replace all return by Chr(13) within the string?!
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 75 total points
ID: 7158432
sText = Replace(sText, vbCRLF, vbCR)

Anthony
0
 
LVL 3

Expert Comment

by:schworak
ID: 7158863
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.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now