lets say i have a text file with the string "ffffffffff" in it and i want to insert "666" after the 2nd "f" in it.. how to do it? i tried the following and it doesnt work..

Dim stream As New System.IO.StreamWriter("xxx.txt")
        stream.Write("ffffffffff")
        stream.BaseStream.Position = 2 
        stream.Write("666")
        stream.Close()

i tried stream.BaseStream.Seek(2, SeekOrigin.Begin) and it doesnt work too..

Recommended Answers

All 3 Replies

Will the position change?

I would think you could use String.Insert()

can u explain? i still cant get it..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.