+ 1
Saving Data or Variable for future use?
how can i save a variable for future use? if the program is terminated and again opened the Variable will same as seted while exiting? any help pz...
9 Answers
+ 2
Saving to the registry isn't recommended (what if the program is run on a different computer or the user doesn't have write access.)
Visual Studio has the ability to create application settings: https://msdn.microsoft.com/en-us/library/25zf0ze8(v=vs.100).aspx
Otherwise, the simplest way would be to save a text file with the value.
+ 1
Save its value in a database or in a text file before you exit your program and retrieve in when your program reloads.
+ 1
Or into Windows registry.
0
no there is another methode i saw in Vb maybe its code is different?
0
This may be useful https://msdn.microsoft.com/en-us/library/bb397750(v=vs.110).aspx
0
Use file descriptors or database.
0
@Evgeny Volnov
how? will u explain please?
0
Some techniques based on OS you use. I think the most common OS for C# will be windows, so check out official Microsoft documentation. https://msdn.microsoft.com/en-us/library/kdfaxaay.aspx
For example just create a file and write variable value each line. After launching just parse each line to variable. It's easiest way to store your data.
About database: make local db using simple SQLite (find some info in Google). Every time your app is launching all the variables will initialising via queries to your database. It's complicated way, but you could try.
0
thanks for this man.