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

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

javascript - jquery or ashx not working -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -