I know how to search a text file for a specific line, but what I don't know is then how to delete that line? Can anyone help?
My text file is set up as such:
021,Donovan,56 Eynesford Crescent,Bexley,SE5 1TR,09/08/1967,13 March 2012,Bronze
062,Fredrikson,6 Freil Road,Gravesend,GR9 TRB,12/06/1995,13 March 2012,Silver
So I know how to search for the 3 character integer at the beginning of each line, but how do I then delete this line?
I'm currently using this code
Imports System.IO Public Class Form6 Private Sub SearchBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SearchBtn.Click Dim WholeFile() As String = System.IO.File.ReadAllLines("C:\Documents and Settings\User\My Documents\Visual Studio 2008\Projects\Members.txt") Dim Search As String = IDFilter.Text & "," For Each line As String In Filter(WholeFile, Search) If line.StartsWith(IDFilter.Text) Then MsgBox("found " & line) End If Next End Sub End Class