i have a file info.ini

which has a text like:

;comment
[management=1]
patid=34
;following fields not need it
lastname=johnson
firstname=tom

[image]
color=445


the questin is how can i delete or replace the patid=34 with some other patid=2
and
lastname=thomas
firstname=glen

?
i tried to write over spaces,but the problem is that i cannot know exactly when is the end of line,and also the real problem is that end of line,i will have to overwrite
with a much longer line,and it will go over next line,and it will be a mess.
as i noticed ,this writing in a file work like the overwrite,not like the insert ,from the keyboard?

i used something like this:
Dim fs As New FileStream("c:\we.txt", FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite)
Dim fs1 As New FileStream("C:\we.txt", FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite)
Dim sr As StreamReader = New StreamReader(fs)
Dim sw As New StreamWriter(fs1)
Dim str As String
Dim allText As String

Do
str = sr.ReadLine()
allText = allText & str

If str = "patid=34" Then
Dim pos As Integer
MessageBox.Show(allText)
pos = allText.Length - str.Length
MessageBox.Show(pos)
fs1.Seek(pos, SeekOrigin.Begin)
sw.Write(Space(20 * 256))
fs1.Seek(pos, SeekOrigin.Begin)

sw.WriteLine("patid=2")
sw.WriteLine(";following fields not need it")
sw.WriteLine("lastname=thomas")
sw.writeline("firstname=glen")
Exit do
End If

Loop Until str Is Nothing
sw.Flush()

sw.Close()

sr.Close()
fs.Close()
MessageBox.Show("end")

so i simulate the deleting,by inserting lots of spaces,but because of that \r\n it will be a mess.beacuse i want to overwrite again other information,with other names,and in file it will be lots of spaces,and that seek() reposition at the end of that file.and all this because the writting is like an overwrite not like an insert,and i'm not able to delete and insert.