|
-
Jul 14th, 2009, 10:56 AM
#5
Thread Starter
Hyperactive Member
Re: [RESOLVED] Can VB6 code direct Windows to create a new file?
Thank you Garrcomm for another very useful piece of code about error handling. I will print it out when I get home and place it in my notes.
The scope for errors in the way I plan to use this file creation routine in a program will be much less than in the test program - in which a user could enter all manner of 'silly' paths.
The intended program logical sequence will be something like this.
1. The program will depend on a long obscure file name which is HIGHLY unlikely to have been used by the user or any other program. For now let us just call it XYZ.txt
2. On opening, the program will try to transfer (by Loadfile) XYZ.txt to a RichTextBox.
3. If no error is generated, the program will assume that file XYZ.txt previously existed (from a previous instance of the program). The program will proceed to parse out of the information now in the RT Box the stored information it requires.
4. If on the other hand an error occurs at Loadfile, then the program will assume that XYZ.txt did not formerly exist and will, i.a.w. your method, generate XYZ.txt. Thus knowing that this is the first time through, the program will not seek to place any dependancy on the text content (since it will be blank).
5. Prior to program close-down, the software will write a data set to the RichTextBox and use the Savefile method to transfer this to XYZ.txt.
6. The program can then close down, and machine be switched off.
7. Next time the program runs, XYZ.txt will exist on that machine, and everything written there will be imported into the RichTextBox.
8. Thus XYZ.txt will act as a mini database, requiring minimum effort to set up and allowing me compete freedom as to format, layout and content.
9. I regard that as a GREAT achievement for today, thanks to you for your invaluable assistance.
Tot Siens
camoore
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|