You are invited to Log in or Register a free Frihost Account!

VB 6.0 saving multipul .txt from a text box need help

ok so im going to make a timer and i want the contense from a text box to save as a .txt file but every 5 mins i want it to make a new txt file leaving the old one still there. so what i need is the code to save a .txt from a text box but to save it as a differnt .txt file each time leaving the old ones un overwrited.

Thanks in advance.
I try to help you.

    1.) define a form or global (module) variable to hold the file number
    2.) To create text file you have two options.
    i) using the standard open statement
    ii) using the filesystemobject from windows scripting hosting, add a reference to it by using the reference menu command.

Hope this help.
If i'm right you might need some more detailed information about this.
First here is the code which will save a textbox to a .txt file:
PATH = (the directory where the file will be saved i.e.: App.Path & "\Data\")
TITLE = (name of your text file i.e.: log)
TEXT = (your textbox i.e.: Text1.Text)

Open PATH & TITLE & ".txt" For Output As #1
    Print #1, TEXT
Close #1

Second saving the next file with a new is a bit more complicated, but heres one way to do it:
Indstead of giving them a new name then make the title like this log1 log2 log 3 and so on.
Then you should make another txt file named fx File_name and then everytime you save a file name you take the last number and save it in the File_name.txt, so that everytime you save a new log, it starts off by reading through the File_name.txt and finds a number that has not been used yet. Then it takes that number and saves the log with that, and afterwards saving that new number in the File_name.txt to make sure you don't use that number twice and thereby overwrite an existing file with that number.
Related topics
FreeBSD 6.0 is up and running!
VisualBasic 6.0 Help
Norton Internet Security 2005 & AIM 6.0
how about security of visual basic 6.0??
Help needed to make text box and poll script
VB Help for those who need small pointers in Visual Basic
DataLife Engine v.6.0 Final - Great Script for your site
Saving a .txt file to a ftp using vb6. i need help please
VMWare 6.0
VB 6.0 need help loading a .txt file into a text box
How can you get cpu usage to display in VB 6.0?
Adobe Photoshop CS2 vs CS3
(AYUDA)actualizaciar drupal 6.0
is it possible to get a html text box to load a .txt file?
Reply to topic    Frihost Forum Index -> Scripting -> Others

© 2005-2011 Frihost, forums powered by phpBB.