Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modifying an existing text file

Status
Not open for further replies.

thetallfulla

Technical User
Jan 7, 2001
3
NZ
Hi, I'm hoping someone can help me...

Is there any way in VB to modify a particular line of an existing text file without affecting the remainder of the file???

any help would be much appreciated,

Cheers
 
Thetallfulla -

If you want to insert stuff into a file (potentially making it larger or smaller), you will want to open the file in VB, read up to the point where you want to change the file, writing it out to a temporary file. Write your changes to the temporary file, then copy the remainder to it afterwards.

If the file isn't too big, you can read it into a string and modify it there before writing it back out.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top