Click here to Skip to main content
15,892,797 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want my program to save some information to use them on the next startup of the program ...
is there any other way better than writing on a text file ???
and if there isn't, can you tell me how to protect this text file and prevent other people from seeing or editing or removing it?

waiting for your suggestions

thanks,
Posted

If you would like to save your settings for your program , you can create a SERIALIZABLE object and dump it to a file .
 
Share this answer
 
Let me suggest some methods to save your application settings for next startup

1) The most common method for doing this is to save your settings using
Properties.Settings

Its very easy to use
Check this links for settings in .Net
http://msdn.microsoft.com/en-us/library/aa730869(v=vs.80).aspx[^]
http://www.dotnetperls.com/settings-visual-studio[^]

2)Or save your information to the registry (Create one key in registry and save your information there)
 
Share this answer
 
Comments
George_Rasmi 17-Sep-11 13:30pm    
I tried your method and it worked perfectly in the project thanks :)
I need one more thing :
according to this method, how to store a String array ???
in other words, I need to store a string array in the program so it can retrieve it every time the program starts...
any suggestions???
Arun Kumar K S 17-Sep-11 21:56pm    
use system.collections.specialized.stringcollection in settings data type
Arun Kumar K S 17-Sep-11 22:06pm    
// Create and initializes a new StringCollection.
StringCollection myCol = new StringCollection();

// Add a range of elements from an array to the end of the StringCollection.
String[] myArr = new String[] { "RED", "orange", "yellow", "RED", "green", "blue", "RED", "indigo", "violet", "RED" };

myCol.AddRange(myArr);
Properties.Settings.Default.MySettings = myCol;
Properties.Settings.Default.Save();

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900