Moving around File

Homer
05-11-2003, 01:56 AM
if I need to delete a certain line from a file, how can i move to that line in write mode?

Daraja
05-11-2003, 11:41 AM
You should probably load the whole file in VB, check every line if it's the line you want to delete, and then write every line back into that file.
I suppose you know how to open a file? Here's the code:


Open "C:\File1.txt" For Input As #1
Do Until EOF(1)
Line Input #1, strLine
Loop
Close #1


Writing to a file, goes like this:


Open "C:\File1.txt" For Output As #1
Print #1, strLine
Close#1


Combine these codes, and your problem is solved! ;)

Homer
05-11-2003, 06:01 PM
Thank you :cool:

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum