I am building a Winform based C# desktop application. I have a number of Combox control which the user can select the input from the drop down list or manually enter an input. The Combox Items itself is populated from a static list.
Whenever the user enters a new input which is not present the list, I add to this static list.
Here is the small code snippet which does that :
if (!this.client_type.Items.Contains(items.ClientType))
{
ComboItems.ClientList.Add(temp.CourtName);
}
So far, this approach works as long as the application does not close or exit. When the application restarts, the list does not have the manually entered items.
I am considering saving the list in a configuration file. Is there any other approach apart from using a configuration file ?
Thanks
Any type of serialization should work. A couple of popular ideas:
Database: If you are already saving data to a database or if you want that same customized list to be available to all users regardless of if they are on the same machine then that may make the most sense.
XML: If the changes should be per box that it runs on then you would want to store it locally. XML is popular and there are libraries available in the framework to work with XML files.
Here is a link to look into other options.