Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27350

VS 2010 writing to a file, from a file

$
0
0
Hello,

i have just a simple question i need help with;

Code:

Dim FILE_NAME As String = "C:\Users\Conor\test2.txt"

                        If System.IO.File.Exists(FILE_NAME) = True Then

                            Dim objWriter As New System.IO.StreamWriter(FILE_NAME)

                            objWriter.Write(currentField)
                            objWriter.Close()
                            MsgBox("Text written to file")

                        Else

                            MsgBox("File Does Not Exist")

                        End If

i have this code in my program, basically what i need is something that stops it appending the same line when its writes to the file, i have a file where it reads out URL's is puts them in a message box, which is taken from currentField. i then want it to write the URL's into another file, when i click ok on the message box of the URL's that appear, but what happens is, when its finished reading all the URL's there is only one in the new file, and its the last URL read, so i guess its over writing each URL every time a new one i read.

is there a way to go to the next line in the text file and put the next URL there instead of it overwriting in the same line very time?

hope this is clear

thanks

Viewing all articles
Browse latest Browse all 27350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>