From: "StrandElectric" Newsgroups: comp.lang.basic.visual.misc References: Subject: Re: Replacing text in a text file with VB6 Date: Mon, 7 Feb 2011 10:10:58 +1100 Lines: 28 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5994 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 203.219.98.219 X-Original-NNTP-Posting-Host: 203.219.98.219 Message-ID: <4d4f2ab0@dnews.tpgi.com.au> X-Trace: dnews.tpgi.com.au!tpg.com.au 1297033904 203.219.98.219 (7 Feb 2011 10:11:44 +1000) Path: csiph.com!eeepc.pasdenom.info!news.pasdenom.info!news.dougwise.org!goblin3!goblin.stu.neva.ru!rahul.net!wasp.rahul.net!rahul.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!nntp3.phx1!dnews.tpgi.com.au!tpg.com.au!not-for-mail Xref: csiph.com comp.lang.basic.visual.misc:1824 "dpb" wrote in message news:iimdlf$37c$1@news.eternal-september.org... > jason@smkzone.com wrote: >> That seems a little complicated just to get the top 3 lines and change >> them. Is there a way to get just those three lines, set each to a >> different variable, and change them one by one? I'm using If >> statements to change it, so that, for example: > ... > > LINE INPUT # will do that. > > But, the thing is about sequential files is that....well, they're > sequential. So you'll still have to rewrite the whole file unless you get > cute and read it as a binary and find the records and replace only the > identical existing length. > Which leads me to throw a complete spanner in the works. I would do it by using a random access file. You can then work on just the record you need. I presume that the database approach uses just serial files. I've always used random myself, since 1980 (!) so I'm more comfortable with it. But don't let that change your approach. I'm the greenest of the green and struggling right now with vb.net (though I have got random access files working there too!). At the moment, I much prefer vb6, mainly for its excellent help system and its support for printing, both of which are abysmal in vb.net!