Welcome to Dream.In.Code
Become a VB Expert!

Join 149,540 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,538 people online right now. Registration is fast and FREE... Join Now!




Appending Text to Existing File

 
Reply to this topicStart new topic

Appending Text to Existing File, Text Appears on Same Line as Existing Text

grinsalot
29 Nov, 2007 - 09:00 AM
Post #1

D.I.C Head
**

Joined: 8 Apr, 2006
Posts: 50


My Contributions
Hi,

I'm appending text to an existing .txt file. I would like the text to appear on a new line. However, it appears on the same line as the existing text in the file. This only occurs during the first write though. Any subsequent writes to the file are correct.

CODE
MyFile.WriteLine(Input & "~")


If I insert the newline character as such:
CODE
MyFile.WriteLine(vbnewline & Input & "~")

then the first time I write to the file the ouput is correct. However, subsequent writes produce double newlines. I assume this is because the writeline method inserts the breaks.

Why am I not getting the initial break though?

Thank you for any assistance.
User is offlineProfile CardPM
+Quote Post

grinsalot
RE: Appending Text To Existing File
29 Nov, 2007 - 09:24 AM
Post #2

D.I.C Head
**

Joined: 8 Apr, 2006
Posts: 50


My Contributions
I figured it out.

I used the writeline method with vbCrLf for the first line of the write, and I used the write method for the second line of the write.

Sorry for the bother.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 09:23PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month