Appreciate the answer, Legendary agent. This is pretty much exactly what I'm looking for - wanting to save variables.
I must be doing something wrong though, because while I'm not getting any errors my open and save buttons don't appear to do anything.
This is what I've got:
Here's my open button:
And here's my save button:Code:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim fileload As System.IO.StreamReader fileload = My.Computer.FileSystem.OpenTextFileReader("../../../AdventureProgress.txt") Dim progressload As String = fileload.ReadToEnd 'This is used to save the details from the adventure progress into a string, you should try with an array instead. fileload.Close() End Sub
Code:Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim filesave As System.IO.StreamWriter filesave = My.Computer.FileSystem.OpenTextFileWriter("../../../AdventureProgress.txt", False) filesave.Write(doonce, Clock, HungerBar, SleepBar, XpBar, Intl, Chr, Spd, Stl, Dex, HealthBar) 'this can be anything you want, a variable, a string, an array, whatever.... filesave.Close() 'everytime you open and save a file you always need to close it because if u do not there will be issues while trying to save to a file which is in use. End Sub




Reply With Quote