I have text file that need to read until *+*+* Top *+*+*
and write the content until *+*+* Top *+*+* but i dont want to write *+*+* Top *+*+* this line
This is my code so far
When i use Replace function to replace that content with space, it still write that line. And I dont know how to fix this problem?Code:Dim myReader As StreamReader = New StreamReader("C:\temp2.txt") Dim myLine As String Dim fc As StreamWriter = File.CreateText("C:\kaya1.txt") Dim sf As StreamWriter = File.CreateText("C:\kaya.txt") Do myLine = myReader.ReadLine() fc.WriteLine(myLine) If myLine.Contains("*+*+* Top *+*+*") Then myLine.Replace("*+*+* Top *+*+*", "") End If Loop Until (myLine.Contains("*+*+* Top *+*+*")) sf.Write(myReader.ReadToEnd()) myReader.Close() myReader = Nothing sf.Close() fc.Close()




Reply With Quote