Hello everyone. I'm a novice, working on a very simple program in both
VB 6 and
VB 2008. Visual Basic 6 seems much easier to write code with, so I'm sticking with it for this project.
I have a form with eight text boxes that I input text into.
There is also a command button. The command button simply creates a text file, and stores the inputted text in that file. Here's the code I wrote for the command button:
Private Sub Generate_Click()
Dim info As String
info = "c:\Movies.txt"
Open info For Append As #1
Print #1, "Title: " & Title.Text
Print #1, "Director: " & Director.Text
Print #1, "Starring: " & Starring.Text
Print #1, "IMDB: " & IMDB.Text
Print #1, "Running Time: " & RunningTime.Text
Print #1, "Genre: " & Genre.Text
Print #1, "Subtitles: " & Subtitles.Text
Print #1, "Year of Release: " & Year.Text
Print #1, "Comments: " & CommentsText
Close #1
MsgBox "Your file has been created."
End Sub
So simple, even I can understand it. So far....
I want to do a few more things with this code, and am requesting help, if I may, please.
First of all, being a novice, I am not yet sure how to add code to the above that lets the file be opened and displayed. In
VB 2008, the code to do this is:
Process.Start("c:\Movies.txt ")
Which I put in after the MsgBox line.
I do not know what to use for Visual Basic 6. Can anyone please tell me what to use?
Secondly: I want the file to be double-spaced. I know I could put
Print #1, ""
In between each line. However, just to learn programming a bit better, I'd like to know if it's possible to write code to double-space the file in one fell swoop, so to speak. Perhaps a FOR-NEXT loop that would automate the process, or some other procedure.
Is this possible? If so, what sort of commands should I use? Is it worth the effort, or would the Print #1, "" option just be easier?
The third thing I want to do is more complex, and I'll save this for another thread. But just to mention it...what I want to do is create a SAVE AS dialog box where the user can select the drive and folder where the file is to be stored, and give the file a name. Is this possible? Would I have to write entirely different code other than the Open File command?
Thank you very much for any assistance you care to give. J. Danniel (Please call me Jd.)