We help IT Professionals succeed at work.

Saving String Data that may include a carriage return

509 Views
Last Modified: 2013-12-25
I use the following code to write data to a file opened for Append
       Write #F, SerialNo; fn; fs, fb; fi; fu; ft; tc; tb; n; TDNtext; SaveFlag
The variable TDNtext is a string read from a TextBox control (Multiline = True).
My problem is that if the user uses a carriage return in the text he is entering this seems to function as an end / new record when the data is written to file.
I can see one way around this by use of a Rich Text Box in place of a normal text box, but I want to avoid that if at all possible
Comment
Watch Question

High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
CERTIFIED EXPERT
Top Expert 2009
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT

Commented:
I don't understand how a Rich Text Box is going to help you.  If the Rich Text Box is Multiline, you're still going to get a CrLf pair between lines.

What are your constraints?  Do your records need to account for line breaks that were in the original text box?  If so, then I would say that "Replace vbCrLf with something else" is not "one solution", but the ONLY solution since a "Record" in your data file appears to be deliniated by new lines.

Author

Commented:
Works fine in VB6 but I do not think that this command exists in VB5. I am just migrating from 5 to 6 so that's not a problem.
Thanks
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.