this what you wanted or did you want to replace the whole line?

VB Code:
  1. 'requires System.IO
  2.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  3.         Dim strFile As String = InputBox("FilePath?")
  4.         Dim strSearch As String = InputBox("Search String?")
  5.         Dim strReplace As String = InputBox("Replace String?")
  6.  
  7.         FileSearch(strFile, strSearch, strReplace)
  8.     End Sub
  9.  
  10.     Public Function FileSearch(ByVal strFilePath As String, ByVal strSearch As String, ByVal strReplace As String)
  11.         Dim strArray() As String = LoadFileToArray(strFilePath)
  12.         Dim retVal As Integer = SearchAndReplaceArray(strSearch, strReplace, strArray)
  13.         WriteArrayToFile(strFilePath, strArray)
  14.  
  15.         MsgBox(retVal & " lines contained '" & strSearch & "'!")
  16.     End Function
  17.  
  18.     Private Function LoadFileToArray(ByVal strFilePath As String) As String()
  19.         Dim sr As New StreamReader(strFilePath)
  20.  
  21.         Dim strLines() As String = Split(sr.ReadToEnd, vbCrLf)
  22.  
  23.         sr.Close()
  24.  
  25.         Return strLines
  26.     End Function
  27.  
  28.     Private Function WriteArrayToFile(ByVal strFilePath As String, ByVal strArray() As String)
  29.         Dim sw As New StreamWriter(strFilePath)
  30.  
  31.         Dim I As Integer
  32.  
  33.         For I = 0 To strArray.GetUpperBound(0)
  34.             sw.Write(strArray(I) & vbCrLf)
  35.         Next
  36.  
  37.         sw.Close()
  38.     End Function
  39.  
  40.     Private Function SearchAndReplaceArray(ByVal strSearchFor As String, ByVal strReplaceWith As String, ByRef strArray() As String) As Integer ' Returns how many changed
  41.         Dim intChanged As Integer
  42.         Dim I As Integer
  43.  
  44.         For I = 0 To strArray.GetUpperBound(0)
  45.             If InStr(strArray(I), strSearchFor, CompareMethod.Text) <> 0 Then 'Match
  46.                 strArray(I) = Replace(strArray(I), strSearchFor, strReplaceWith)
  47.                 I += 1
  48.             End If
  49.         Next
  50.     End Function