I know how to write to a file, however, I want to be able to write to a certain line. I have a large csv file which has many lines.
I can only write to the last line (using the writeline) but I really want to write to line x of 50 lines.
How do I do this?
Best How To :
I don't know if you can write to a specific line in a file, but if you need to you can write your lines to a List then write the list to a file
'Declare your list
Dim lines As New List(Of String)
For Each lineToWrite In YourLines
If toInsert Then
'In this way you insert a row at the specified index, but this will grow the list not overwrite.
ElseIf toOverwrite Then
'In this way you overwrite the item at the specified index
lines(indexToOverwrite) = lineToWrite
'Or you can just append it
'This will write the file