writing text to text files in vb. need help

G

Guest

hello all,
I've already posted a thread with the same problem but
couldn't satisfactory answer. Let's come to the point.

I can write some text to a text file with WriteAllText method. How can I
start new lines? Example, c:\test.txt is a file, then:

"This text should be written in 1st line of c:\test.txt"
"This text should be written in 2nd line of c:\test.txt"

Please write a that demonstrate the above task.

bye
 
R

Robert Dufour

Dim MyLine as string
MyLine = "this is line 1" & vbcrlf
however you do append this line to your open text file, next
Myline = "this is line 2" & vbcrlf
however you do append this line to your open text file, next
and so on
HTH
 
A

Armin Zingler

johnabraham101 said:
hello all,
I've already posted a thread with the same problem
but couldn't satisfactory answer. Let's come to the point.

I can write some text to a text file with WriteAllText method. How
can I start new lines? Example, c:\test.txt is a file, then:

"This text should be written in 1st line of c:\test.txt"
"This text should be written in 2nd line of c:\test.txt"

Please write a that demonstrate the above task.

bye


http://msdn2.microsoft.com/en-us/library/k3352a4t.aspx

Especially, if "new lines" means appending to a file:
http://msdn2.microsoft.com/en-us/library/3zc0w663.aspx

Also:
http://msdn2.microsoft.com/en-us/library/y32kbeb6(VS.71).aspx


Armin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top