I need to find a section header, in this case "[Store Hours]", in a text file that I'm using to save the settings for the program. I need to skip the header and replace the next 7 lines with the text that is in the text boxes. The code below currently deletes the header "[Store Hours]" and does not replace any of the lines.
 Dim objFileName As String = "Settings.txt"
    Private Sub BtnAdd_Click(sender As System.Object, e As System.EventArgs) Handles btnSaveHours.Click
        Dim OutPutLine As New List(Of String)()
        Dim matchFound As Boolean
        For Each line As String In System.IO.File.ReadAllLines(objFileName)
            matchFound = line.Contains("[Store Hours]")
            If matchFound Then
                'does not skip the header line
                line.Skip(line.Length)
                'Need to loop through this 7 times (for each day of the week)
                'without reading the header again
                For intCount = 0 To 6
                    Dim aryLabelDay() As String = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}
                    Dim varLabelNameIn As String = "txt" & aryLabelDay(intCount).ToString & "In"
                    Dim varDropNameIn As String = "drp" & aryLabelDay(intCount).ToString & "In"
                    Dim varLabelNameOut As String = "txt" & aryLabelDay(intCount).ToString & "Out"
                    Dim varDropNameOut As String = "drp" & aryLabelDay(intCount).ToString & "Out"
                    Dim varTextBoxInControl() As Control = Me.Controls.Find(varLabelNameIn, True)
                    Dim varDropBoxInControl() As Control = Me.Controls.Find(varDropNameIn, True)
                    Dim varTextBoxOutControl() As Control = Me.Controls.Find(varLabelNameOut, True)
                    Dim varDropBoxOutControl() As Control = Me.Controls.Find(varDropNameOut, True)
                    Dim dymTextNameIn As TextBox = DirectCast(varTextBoxInControl(0), TextBox)
                    Dim dymDropNameIn As ComboBox = DirectCast(varDropBoxInControl(0), ComboBox)
                    Dim dymTextNameOut As TextBox = DirectCast(varTextBoxOutControl(0), TextBox)
                    Dim dymDropNameOut As ComboBox = DirectCast(varDropBoxOutControl(0), ComboBox)
                    Dim ReplaceLine As String
                    ReplaceLine = dymTextNameIn.Text & "," & dymDropNameIn.Text & "," & dymTextNameOut.Text & "," & dymDropNameOut.Text
                    'this doesn't replace anything
                    line.Replace(line, ReplaceLine)
                    intCount += 1
                Next intCount
            Else
                OutPutLine.Add(line)
            End If
        Next
    End Sub
 
     
     
    