Reply to thread

I havent tested this but its the jist of what you need to do: load the file, find what you need to change, change it, and save the file.

[VB]

Dim lines As String() = System.IO.File.ReadAllLines(filename)


 Loop through lines

For I As Integer = 0 To Lines.Length - 1

    Dim line As String = lines(i)

  

    Sparate command and value

    Dim parts As String() = line.Trim().Split(new Char() {" "c}, StringSplitOptions.RemoveEmptyEntries)


    Somewhat validate data

    If parts.Length = 2 Then

        Check if its what were looking for

        If parts(0) = nameImLookingfor Then

            Update value

            lines(i) = nameImLookingFor & " " & newValue.ToString()

            Return  Stop looking

        End If

    End If

Next I


When done, use File.WriteAllLines to update file.

[/VB]


Back
Top