Saving + loadint Text

Zmanvb
11-14-2001, 04:44 AM
I thought maybe you could help me with a game the game is going to have to be able to save and load a bunch of text boxes so if you can show me an example of something that uses text boxes that save and load that would be great my e-mail is Zachpc2000@aol.com
Thanks

Neil_Knight
11-14-2001, 04:55 AM
This is the very basics. If you have any further questions about it please ask.

Neil

bradac
11-17-2001, 04:07 PM
Here's an example of loading and saving (slightly more complex). Note that the "Current Players" box is a Listbox
set to MultiLine=yes and Sorted=true.

joffee
12-17-2001, 12:56 PM
to save and load a text file into a textbox, or any file into a textbox you can add a component called Microsoft Common Dialog. This control is a good file handler. To do this simply make a textbox, make it multiline and then do this coding into the your save function...

'keep in mind your going to be using some 16bit coding, like QBasic could even handle.

Dim strString as text1.text
CommonDialog1.ShowSave

Open CommonDialog1.Filename for Output as #1
'This code opens the filename for writing to.
write #1, strString
'writes the text that you delcared from TextBox1
Close #1
'Closes the file that you were just writing too, so that it can't
be wrote to anymore...

To Open the file or any file then simply do this using the Common Dialog control...

To load a textfile do this...

Commondialog1.ShowOpen

Open CommonDialog1.Filename for input as #1
'This opens the filename ONLY to be read from.
text1.text = input(LOF(1) ,1)
'this inputs the text from the file you just selected...
Close #1
'Closes the file from being read from...

and that's it, that's all you have to do to save or load a textfile, or anytype of file... If i had tutorial priviliges I would write a tutorial on how to add your program correctly to the registry so that you could create your own file extensions. That way whenever you clicked a .jof file persey, it would open your text editor. If your interested in this tutorial anyway, please e-mail me... - Jof.

p.s. if you find any errors in my code let me know... jof

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum