Hi, I am using c# combo box controls where I would like to allow the users to enter new values. i.e I have the DropDownStyle = DropDown. For example, I have a combo box that allows users to select/enter the country code. While loading the form I set the dataset for the combobox by querying database for the code and displaytext for the countries. User can either select an existing country code or enter a new one. Please don't ask why I can't pre populate the combo box with all possible country codes as it is a finite set with infrequent changes, it is the customer requirement and besides there are several controls like this (test center, etc).
Now the way currently the combo box works is, if the user types in a new entry, I add the new value to the database and refresh the dataset. I do this so the new entry has a proper unique code in the database. This slows down the application a bit though it is not a frequent operation. Currently I also set the AutoCompleteMode property to SuggestAppend. This is to prevent users from adding a duplicate entry or entering misspellings of existing entries.
What is the best practice in this regard? Is it better to add new entries in memory and add them to the database at a later stage? It is a multi-user application and it is also possible someone else could also be adding the same entry though it is rare.