Hi All,

I have a checkedlistbox on my windows form. whatever Items user selects - I want them to be remembered by application for next time run - Means next time same items should be checked. To my solution I stuck at a particular point
I want itemindex of the text which I pass..(of course that text is there as one of the items in the checkedlistbox) - if you have some fresh solution to this problem - please help.

many thanks
Jeet

Danny, they can use flat file (CSV) to save user selected indices
i.e
0,4,5,3
Then on form load he can read the file do these indices selected.

That's of course an option Ramy, but I have always been told not a very good one. If you loose the file, you loose your settings. Store settings inside the app as a resource and you don't have that problem.

That's can be done with .settings file! nothing guaranteed :) they can use database but I don't think it's proper use.

Using a csv file would only be a good choice if the program would allow for multiple users, or for multiple sets of data, or on a portable media such as a flash drive and you wanted to be able to save settings and data together for load when necessary.

the C# system settings located in the properties namespace actually saves the preferences in the user folder on the harddrive, C:\Documents and Settings\User\Local Settings\Application Data\programname\exename and identifiing data\buildnumber\user.settings

and is very simple to use, automatically creates the file on run if the system lacks one. and the data stays persistant. So even if it was a standalone app. and you were running it off a flash drive, as long as its used on the same computer and the same user. The settings would load.

So, in most cases. I agree with ddanbe. the properties.settings method is the best and easiest way to go about something simple like this.

Comments
I'm just a simple guy, your knowhow is unquestionable!
This article has been dead for over six months. Start a new discussion instead.