-
I have this in my code:
Code:
Open "C:\02.dat" For Append As #1
Write #1, txtuser.Text, txtpass.Text
Close #1
now if someone runs the program
it saves to that file
now if someone runs the program again, it adds to the file
how do I make it so that if the person opened the program the second time, it would replace what was already there, instead of add to it?
-
Don't use the Open...Append.
Instead, try this:
Code:
Open "c:\02.dat" For Output As #1
Write #1, txtuser.Text, txtpass.Text
Close #1
-
You having file problems again, dimava? :)
reeset is correct: When you open for APPEND, lines (records) are added to the end of the file (if the file does not exist, it will be created). When you open for OUTPUT, a new file will be created (or overwritten) every time.
-
-
Dimava, if you are adding text to a file..say Autoexec.bat, you'd use Append. If you want to write a file or overwrite it, than you would use Output.
Understand? Good :).
-
ok, thanks, I get it :):):):):):):)