09-08-2003, 03:48 PM
Im making a very simple form type program in VB 6. When the user presses submit it prints a page on the network printer. It also needs to save a copy of the form in a text file NAMED what the user puts in the first text box named datetxt.text. So basically the saved text file needs to be named the date the user puts in like "01012003.txt". I need some help doing it though!! does anybody have some ideas? I know it will probobly envolve some variables of some sort but thats all i know Im very new to this. Any help would be greatly appreciated!!
09-08-2003, 03:51 PM
What do you have so far?
I know how to save text files by predetermined names but i want to save them as a variable the user enters.
I was just playing with it and figured out that part
09-08-2003, 04:09 PM
So your problem is getting user input? There are many ways. Common ones are:
1) Have them enter it into a textbox control on your form.
2) Have them enter it into an InputBox
3) Use the CommonDialog control to show the standard open/save dialogs.
09-08-2003, 04:13 PM
Well actually I know all of that, I have the program almost finished. I have made the print command work and all of the boxes are set up I just cant figure out what i have to put in for the text document to be saved as what the user has put in as the filename. I dont know if the commondialog box is the best way for saving or if i can get it to do it automatically how i want it.
09-08-2003, 04:19 PM
I don't understand. You know how to save files. You know how to get a filename from the user. Where's the problem?
09-08-2003, 04:23 PM
the problem is i dont know how to use the input from the user in the text box (whatever it may be) and save the file by that input data. Like, the user types in "happy" in the box and presses a button i want it to save as "happy.txt" somewhere on the hard drive automatically. I really dont know what code to use to do it though.
09-08-2003, 04:25 PM
filename = "c:\" & txtFileTitle.Text & ".txt"
then just use filename to as the complete file path to save to.
09-08-2003, 04:34 PM
OK!! it worked!! Thanks alot!
You just dont know how stumpted i was before!
Im done with the program now!
09-08-2003, 09:02 PM
You should check into the CommonDialog control. It's a standard tool for openning and saving files, among other things.