Hi Friends ,
i want to delete the particular string (content) in file .. how to search the content to delete .. or any other way to solve this problem .. how to do this .. plz help me..
Printable View
Hi Friends ,
i want to delete the particular string (content) in file .. how to search the content to delete .. or any other way to solve this problem .. how to do this .. plz help me..
This question has been asked and answered in various guises multiple times. You have to read the whole file in and then write it out again minus the line in question. There are numerous variations but I'd do it something like this:vb Code:
Dim filePath As String = "file path here" Dim target As String = "target string here" Dim lines As String() = IO.File.ReadAllLines(filePath) Using writer As New IO.StreamWriter(filePath) For Each line As String In lines If line <> target Then writer.Write(line) End If Next line End Using
ya its working fine .. thanks