how to not write over lines in vb.net csv file

D

D

i have something where i am parsing information into a csv file with
created headers. the script gets replayed as it tests several user
profiles. how can i get it to continue writing on the last line (and
not rewrite over info.) of the file where it left off?


on another note, how to get rid of extra quotes in the csv file output?
vb.net 2003 doesnt like when i take them off or add on more.


this is what I have now:

Dim user As String = "V C"
Dim HtmlTable_0_Text As String = "test"
Dim stext As String = "bfsdbfbfebfe vswvgfsbefb_"
Dim Record As String = user + ",""USA""," + HtmlTable_0_Text,+
"""" stext, """
Dim Record1 As String = "Username"",""Countryname"",""Welcome
Screen"",""Html Link"",""Window displayed"
Dim i As Integer
Dim Recordarray() As String

Dim Recordcount As Integer
FileOpen(1, "C:\Axlrose.csv", OpenMode.Output)

Do Until Recordcount = 2
Recordcount = Recordcount + 1

If Recordcount <> 2 Then

Dim splitstring() As String = Split((Record1), ",")
For i = 0 To splitstring.Length - 1
' Write(1, splitstring(i))

If i = 4 Then
MsgBox("test")
WriteLine(1, splitstring(i))

Else
Write(1, splitstring(i))
End If
Next

FileClose(1)
Else
Dim splitstring() As String = Split((Record), ",")
FileOpen(1, "C:\Axlrose.csv", OpenMode.Append)

For i = 0 To splitstring.Length - 1
Write(1, splitstring(i))

Next
FileClose(1)
End If
Loop
End Function
End Class
 
J

Jim Underwood

Change the open line to
FileOpen(1, "C:\Axlrose.csv", OpenMode.Append)

This should append to the end of the file instead of overwriting it.
 

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