Insert a char in a string when a char is found

Posted on 2003-03-01
Medium Priority
Last Modified: 2010-05-01
ok here's the simple thing: I have a string, let's say:
String = "Mywierd\nLovely\nString"
what do I need?
String = "Mywierd\n\nLovely\n\nString"
actually I have a msgbox like this and I need to save it to a file like the second one. So When I'm printing to the file I'm supposed to add \n\n for each \n.
A small and simple code would be great. I'm using:

Open CommonDialog.FileName For Output As 1#
Print #1, textbox1.text
Close #1

Thanks everyone!
Question by:magb
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
  • 2

Accepted Solution

jayeshshah earned 112 total points
ID: 8048389
just write

Open CommonDialog.FileName For Output As 1#
Print #1, repalce(textbox1.text,"\n","\n\n")
Close #1


LVL 14

Expert Comment

ID: 8048463
Jayesh gave you the right answer, beware of the typo 'repalce', it should be 'replace'


Author Comment

ID: 8048755
yes, it was replace :) Great really! Just what I wanted. Thanks!

Author Comment

ID: 8048757
Sorry... points!

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month9 days, 17 hours left to enroll

762 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