-
Hello to All!
I have made a game, and no want to add the options "SAVE" and "OPEN", i´m using the component that comes with vb6 and i can create a file using the save dialog, But i don´t know who to save the data, in the game the player can make or lose money, buy or sell items and many other things, for the items i have a list box for the money a label, who can i save that data to a file and open it back using the open dialog.
If someone could help me, i would be thankfuly, because if i can´t arrange a solution i wont be able to put that options on the game.
-
I don't really understand. Are you having trouble using the Common Dialog box? Here's an example of it. Make a from with...
1 Common Dialog
1 Button
1 Textbox
Code:
Private Sub Command1_Click()
On Error Resume Next
Dim SaveFileName
CommonDialog1.filename = Text1.Text
CommonDialog1.ShowSave ' Show save dialog.
' If the CancelError is not generated
If Err <> 32755 Then
SaveFileName = Commondialog1.filename
Open SaveFileName For Output as #1
Write #1, Text1.Text
Close #1
End If
End Sub
If you want to know what to save, just save the values according to your game status. For example, if lblMoney.Caption is the amount of money, than save that. If the character's name is stored in CharName, than save that.
To open it, all you have to do is retrieve that in the specific order you saved it in.
If you do not understand, I can try to explain myself a little better.
[Edited by Megatron on 05-16-2000 at 05:39 PM]