| Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free! |
Write to file noob question
|
Original Message
|
Name: kaw22
Date: September 24, 2005 at 02:38:31 Pacific
Subject: Write to file noob questionOS: Windows XP Home SP1CPU/Ram: AMD 3200+ 512 MB PC3200 r |
Comment: im trying to figure out how to write to a file.. eg. i enter details into my form press save and it saves all the details to "C:\test.txt" but everytime i try it creates a new test.txt file and deletes whats in it.. im looking for a code that will print details like... Details: blah blah blah blah blah blah //Then when clicked again will save the same under.. so it will end up like this: Details:
blah blah blah blah Details: blah blah blah blah The code would be nice :P if not a URL would help :D thanks
Report Offensive Message For Removal
|
|
Response Number 4
|
Name: kaw22
Date: September 24, 2005 at 08:49:06 Pacific
|
Reply: (edit)Alright this is annoying me now, can sum1 please just post an example of the code? no websites i can find have any information on how to write to files other then writing to files in vb.net Please!
Report Offensive Follow Up For Removal
|
|
Response Number 6
|
Name: wizard-fred
Date: September 25, 2005 at 02:48:38 Pacific
|
Reply: (edit)The explanation of the different modes of file access is quite long. I would recommend you use Help in VB, sorry I can't point you to the exact examples because the help was not installed in my VB due to the limited disc space in my laptop. The problem is how OPEN handles sequential files. In OUTPUT mode essentially a new mile is created everytime. Data is always written from the beginning while the file is open. That is why you are getting only one data set. In INPUT mode the data pointer is at the beginning of the file and the data is successively read till the end APPEND mode may be the method you want. Here a file is opened and the pointer is placed at the end of the file subsequent writes will allow you to place data at the end (the append). There are other techniques to allow you to change data.
Report Offensive Follow Up For Removal
|
|
Response Number 7
|
Name: kaw22
Date: September 25, 2005 at 05:02:16 Pacific
|
Reply: (edit)I found it out, thanks wizard, poor excuses lol not enough disc space :| i recon you have downloaded the program like me lol, cant you use ICON's on your programs ither? Below is for people with same problem (if any1 is a noobish as me) Private Sub Command1_Click() Open "C:\Worker log\WorkerLog.txt" For Append As #1 write #1 YOUR TEXT HERE Close #1 End Sub
Report Offensive Follow Up For Removal
|
|
Response Number 8
|
Name: wizard-fred
Date: September 25, 2005 at 07:33:25 Pacific
|
Reply: (edit)I'm out of space as I have only a 2G HD with Win98SE, Word 2K, Access 2K, Excel 2K, VB6, DOS Apps, plus 4 browsers and networking on 32M of RAM. You will have to add a little more when you try to edit an older data set.
Report Offensive Follow Up For Removal
|

Post Locked
This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
Go to Programming Forum Home