Question:
Visual Basic delete text from a Text file or replace?
2009-07-20 07:54:01 UTC
I am trying to make it so that i can delete the text or replace text in a text file in Visual Basic 2008.
Any ideas?
thanks in advance
Three answers:
2009-07-20 08:17:21 UTC
To replace a piece you have to rewrite the data out to the file. What I would do is set the file pointer to where the data begins that you want to change, you'll need to use the file streak seek method giving it the offset to where the data is.



Next, write out the "new value"



Finally, write out everything after the new value.



This assumes that you have read the entire file into a local buffer, or at least everything from after the point you want to change.



Does that help?
[ juxtapose ]
2009-07-20 07:59:03 UTC
First off, we have no idea how you plan to achieve that because you haven't given us any detail. That's an awfully broad question.



Second, why would you want to make a program that edits a text file when you can just open up the text file any edit it yourself? Granted, there are good reasons to want to do this, but without an explaination it makes no sense.
Erika
2016-10-29 02:58:01 UTC
60 seconds? looks like nag-ware to me. Use threads; i assume you desire to be waiting to do different issues in that 60 seconds, so, spawn off a thread that waits for 60 secs and then does something. as for seek google, study the text fabric record (use readline) then technique the question. you do not say once you like the subsequent question to ensue - in a window that the consumer has to push aside? Or do you convey at the same time the outcomes and learn it later? As for the syntax, which could - and does - substitute, so which you would be able to desire to apply a google API for that. touch google for as much as date information.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...