Hi, i'd like to replace few lines in my document but i don't know how to make working this code (it only changes one line)
for ex. from my test.txt i want to
search for "Replacetext1" and replace with "Hello!"
search for "Hi" and replace with "Hi!"
Then save in mod.txt
Dim sR As New IO.StreamReader(Application.StartupPath + "test.txt")
Dim sW As New IO.StreamWriter(Application.StartupPath + "mod.txt")
While Not (sR.EndOfStream)
sW.WriteLine(sR.ReadLine.Replace("Replacetext1", "Hello!"))
End While
sR.Close()
sW.Close()
Thank you
for ex. from my test.txt i want to
search for "Replacetext1" and replace with "Hello!"
search for "Hi" and replace with "Hi!"
Then save in mod.txt
Dim sR As New IO.StreamReader(Application.StartupPath + "test.txt")
Dim sW As New IO.StreamWriter(Application.StartupPath + "mod.txt")
While Not (sR.EndOfStream)
sW.WriteLine(sR.ReadLine.Replace("Replacetext1", "Hello!"))
End While
sR.Close()
sW.Close()
Thank you