Solved

Printing string!

Posted on 2002-07-16
5
120 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

733 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