M48
METRIC,LZ
VER,1
FMAT,2
T00
T168
T169
T170
T176
T250
DETECT,ON



I want to add some text beside the text which contain "T" I have the same value below the line DETECT,ON but i just want to add text to the lines between FMAT,2 and DETECT,ON. Can i use indexOf methode to get the lines between FMAT,2 and DETECT,ON

For now i used this code to add text
Code:
Dim filename As String = strFileName
        Dim tfLines() As String = System.IO.File.ReadAllLines(filename)

        If File.Exists("C:\kaya.txt") Then

            Console.WriteLine("{0} already exists.", "C:\kaya.txt")
            Return
        End If

        Dim objwriter As StreamWriter


        objwriter = File.AppendText("C:\kaya.txt")

        For x As Integer = 1 To tfLines.GetUpperBound(0)
                            If tfLines(x).Contains("T240") Then
                    objwriter.WriteLine("T240" & "C3.175F012S27H2000")

                ElseIf tfLines(x).Contains("T00") Then
                    tfLines(x).Replace("T00", "")


                ElseIf tfLines(x).Contains("T239") Then
                    objwriter.WriteLine("T239 " & "C0.95F034S55H1000")

                ElseIf tfLines(x).Contains("T236") Then
                    objwriter.WriteLine("T236" & "C1.2F029S48H2000")


                ElseIf tfLines(x).Contains("T234") Then
                    objwriter.WriteLine("T234" & "C1.6F029S48H2000")


                ElseIf tfLines(x).Contains("T232") Then
                    objwriter.WriteLine("T232" & "C1.95F022S37H2000")


                ElseIf tfLines(x).Contains("T230") Then
                    objwriter.WriteLine("T230" & "C2.4F017S3H2000")



                ElseIf tfLines(x).Contains("T229") Then
                    objwriter.WriteLine("T229" & "C3.3F005S16H2000")
End If

                objwriter.WriteLine(tfLines(x))

                  Next

        objwriter.Close()

I want the text to be added to the T value above the line DETECT,ON. because this code add the text beside T whenever it finds the T value.

I dont know how add line only between line FMAT,2 and DETECT,ON?