vb.net - Write to a specific line in txt file when the line is empty -


i working on file writing in vb.net. know how override specific line in text file when empty or equal "" , fails.

i tried with

dim lines() string = system.io.file.readalllines("filepath") lines(4) = "to replace text" system.io.file.writealllines(filepath, lines) 

it shows index out of array exception. might because line in file empty.

thank you


Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -