I wrote an app in C# which allows user to select a directory and does some simple things on the files in the directory. Now I want to add a ListBox to it that saves the most recent 5 selected directories. I don't want to hook up my app to a db because it's a very simple app. I can save the values to a txt file but I don't think that's the best practice. Is there any built-in features in Visual Studio Windows Form Application which allows me to do that? (I tried *.resx file and it doesn't seems to work for such purpose.)
Asked
Active
Viewed 877 times
0
-
2Project + Properties, Settings tab. A StringCollection is the natural choice. – Hans Passant Jun 09 '14 at 18:39
-
2look here for some good examples http://msdn.microsoft.com/en-us/library/system.resources.aspx || http://stackoverflow.com/questions/676312/modifying-resx-file-in-c-sharp – MethodMan Jun 09 '14 at 18:41
-
File is the good choice. – Sriram Sakthivel Jun 09 '14 at 18:44
-
But Settings are easy for manipulation. We don't need to open ‚ save and close file. – Lamourou abdallah Jun 09 '14 at 19:09
1 Answers
4
The use of Settings can do this feature. It is so sample just go to the project properties and add a new propertie with type StringCollection . You can manipulate this propertie like a sample collection by add ‚remove paths. Take a look in this tutorial : http://blog.csharphelper.com/2011/08/18/use-a-setting-that-contains-a-string-collection-in-c.aspx

Lamourou abdallah
- 344
- 2
- 12