Hey. I'm not so much "new" to VB, but I dont know much, just as much as I was taught in school. What I'm doing for a school project, is creating an application, that can save information, and close out, then open up again, and load the saved data. I'm not exactly sure what you would do. The application is basically a voting application, for a 3 night talent show.
Thanks!
Save/Load Data?
Started by slovig, Mar 03 2008 03:05 PM
2 replies to this topic
#1
Posted 03 March 2008 - 03:05 PM
|
|
|
#2
Posted 04 March 2008 - 08:07 AM
I'm working on a program right now and a feature I want is basically the same idea. To save a few options in a file so when the program restarts a user doesn't have to reset all their preferred options.
While I don't know if there's a "correct" way to do it, this is what I've considered doing (Using VisualStudio '05):
With a File stream (Import System.IO) save data to a text file in a specific format:
then when the program loads, or whenever you want, load the text file into a variable and parse it apart.
Then split up the resulting string LoadOptions to get the various user options.
Hope that helps (and was correct, I'm only a novice myself :o)
While I don't know if there's a "correct" way to do it, this is what I've considered doing (Using VisualStudio '05):
With a File stream (Import System.IO) save data to a text file in a specific format:
Dim UserOptions as String = "option1:on|option2:off|option3:off" Dim Path As String = "C:\Options.txt" Dim SaveOptions As New StreamWriter(New FileStream(Path, FileMode.Append, FileAccess.Write)) SaveOptions.WriteLine(UserOptions) SaveOptions.Close()
then when the program loads, or whenever you want, load the text file into a variable and parse it apart.
Dim LoadOptions As String Dim Path As String = "C:\Options.txt" Dim ReadOptions As New StreamReader(New FileStream(Path, FileMode.Open, FileAccess.Read)) LoadOptions = ReadOptions.ReadToEnd LogMessage.Close()
Then split up the resulting string LoadOptions to get the various user options.
Hope that helps (and was correct, I'm only a novice myself :o)
#3
Posted 04 March 2008 - 03:07 PM
Thanks. But I think I'm gonna step away from this. I've decided to let someone else create it.
[\.slovig./]


Sign In
Create Account

Back to top









