hi, I am trying to write a file in a loop. Each time it should write seomthing differnet. Instead of rewriting the file, my program adds the new information ot hte file. how can I make it rewrite.
my code:
Dim writer As New IO.StreamWriter("C:\my folder\ad.html")
For i = 1 To 5
........
reget(uName)
jLinks = String.Join(",", v_link, 0, v_rem)
writer.Write(jLinks)
writer.Flush()
next
now jLinks changes each time but it is being added at the end of the file while I need it to replace the whole file. I thought about erasing it so that It would create a new one each time but I get a sharing violation. I am pretty sure this is simple to do, just not sure how
my code:
Dim writer As New IO.StreamWriter("C:\my folder\ad.html")
For i = 1 To 5
........
reget(uName)
jLinks = String.Join(",", v_link, 0, v_rem)
writer.Write(jLinks)
writer.Flush()
next
now jLinks changes each time but it is being added at the end of the file while I need it to replace the whole file. I thought about erasing it so that It would create a new one each time but I get a sharing violation. I am pretty sure this is simple to do, just not sure how