473,789 Members | 2,833 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I modify a record in a textfile in vb?

How do I modify a record in a textfile in vb? Do I need 2 files?
JOhn

---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/
Nov 20 '05 #1
15 1135
Cor
Hi John,
How do I modify a record in a textfile in vb? Do I need 2 files?


Yes

Cor
Nov 20 '05 #2
* "Cor" <no*@non.com> scripsit:
How do I modify a record in a textfile in vb? Do I need 2 files?


Yes


Why?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
Cor
Hi Herfried,

Did I forget again something?

I thougth one file to read the data and one file to write the changed data
back.

I am curious, because now you bring me in doubt that I have seen something
from you to do it in another way.

Cor

Nov 20 '05 #4
* "Cor" <no*@non.com> scripsit:
Did I forget again something?
No, you didn't.
I thougth one file to read the data and one file to write the changed data
back.


Why not write the data back to the same file?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #5
Cor
Hi Herfried,
Why not write the data back to the same file?


I am glad I can teach you something,

That is something you never should do.

You cannot prevent that by example on an unwanted moment the power goes
down.

So with streaming operations it has for me always to be.

Read file
Write file to tempfilename
delete inputfile
rename tempfilename to original name

Or any other save sequence of this.

Cor
Nov 20 '05 #6
"Cor" <no*@non.com> schrieb
Hi Herfried,
Why not write the data back to the same file?


I am glad I can teach you something,

That is something you never should do.

You cannot prevent that by example on an unwanted moment the power
goes down.

So with streaming operations it has for me always to be.

Read file
Write file to tempfilename
delete inputfile
rename tempfilename to original name

Or any other save sequence of this.

I've made the same suggestion but I was adviced not to do it because it
would change the file creation date or the original file. Another way is to
create a backup of the original file, read from the backup, write into the
original file (and truncate it if necessary) and delete the backup.
--
Armin

Nov 20 '05 #7
Cor,

* "Cor" <no*@non.com> scripsit:
Why not write the data back to the same file?
I am glad I can teach you something,


I am glad to teach you something too.
That is something you never should do.

You cannot prevent that by example on an unwanted moment the power goes
down.

So with streaming operations it has for me always to be.

Read file
Write file to tempfilename
delete inputfile
rename tempfilename to original name


No! This will change the creation timestamp of the file. Better:

Read File
Write File to Tempfile
Overwrite File with Tempfile
Delete Tempfile

;-)

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #8
Cor
Hi Herfried,

And what is your advice if I want to change the creation timestamp because I
find every change of a txtfile a creation?

No! This will change the creation timestamp of the file. Better:

Read File
Write File to Tempfile
Overwrite File with Tempfile
Delete Tempfile

Still it are two files and I said any other save sequence so there cannot be
a better.

:-)))

Cor
Nov 20 '05 #9
"Cor" <no*@non.com> schrieb

And what is your advice if I want to change the creation timestamp
because I find every change of a txtfile a creation?


change <> creation

(IMO)
--
Armin

Nov 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4487
by: Franco Fellico' | last post by:
Hi. Suppose to have read and displayed (using PHP) a group of row of a DB table on a dinamyc table on a HTML/PHP page. The number of row displayed could be from 1 to n. Each row contains informations and also a cell with a unique ID of the element. I would like to show at the beginning of each line of the table a couple of cells containing two different icons (one for delete and one
7
5031
by: Hans A | last post by:
I have a textfile "textfile.txt" containing a list of words. There is one word on each line. I want to pick two random lines from this textfile, and I have tried to do something like: //Loading the file into an array: $textarray = file("textfile.txt); //Using array_rand to pick two random words $rand_numbers = array_rand($textarray, 2);
5
1225
by: Gunnar G | last post by:
Hello. If I wish to open a huge textfile and only change the 300th line in the file, how do I do that?
0
422
by: karenmiddleol | last post by:
The following code works fine I can connect to a SQL database and list all the records in the Orders table onto a web page. Now our users want me to modify it so that each row displayed as a button or a hyperlink for Modify, Delete and also they want the data displayed not in a HTML table as I am doing but like in a form they want the ability to change the data in the fields. So when the user clicks on the modify button for a row then...
5
2860
by: asd987 | last post by:
Hi, I'm now working with Access 2000 (English) and I'm searching for an option which I can't find. I used to work with Acces 97 (Dutch) and there was a possibility to record a macro. I used this to load a textfile into a table. You had to follow all the steps once and then they were recorded by Access. The next time you could play this sequence of commands. I searched in Access 2000 but couldn't find the option. Probably also due to...
4
6204
by: muttu2244 | last post by:
Hi everybody Am trying to read a csv file "temp.csv", which has the below info, compName macAddr ipAddr opSys
18
2001
by: Jen | last post by:
Is it possible (how) to display a new record every week (or day) from a recordset?
3
1818
by: Ray | last post by:
Hello World, I made a Windowsform that reads data from a CSV file. It works fine, but when I have read the data of a record I have to re-Debug the form to read another record. So when I put a new seek item in the textbox after I searched for an item and click the seek button.. it seems it is doing nothing. And also... what code can I use to genereate a messagebox message when a seek item is not at all in the CSV file?
1
2819
by: asedt | last post by:
With my Excel macro and two text files I want to create a new textfile containing the first textfile then text from the sheet and then the second textfile. My problem is that i don't know how to append the second textfile. Sub mysub() Dim TempString As String 'Open the first file Dim fileA As Integer
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10410
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9984
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9020
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3701
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.