views:

267

answers:

1

Hi, I want to maintain a list of potential ComboBox values over multiple executions of my program, and to use that list as the DataSource on multiple ComboBoxes. I also want changes made to the DataSource to propagate over all of the ComboBoxes already existing in the application.

Can someone recommend what type of object I should use as my DataSource, as My.Settings objects don't seem to support generic list objects.

Also, along with that recommendation, can I also ask for suggestions as to how to propagate the updates of the collection to all ComboBoxes? I would imagine I need a collection type which raises events when its contents change, but I can't think of any, and in any case do not know which are compatible with My.Settings.

Hope I've made this situation clear. Thanks

+1  A: 

If you're just storing strings, you can use a StringCollection. It will work with My.Settings. I'm not sure if you can bind a StringCollection directly to the comboboxes though...

Note that you can also use a custom type in My.Settings. You need an empty constructor in your custom type so that it can be serialized. If you expose a generic collection as a property of your custom type, I believe it will be saved to My.Settings correctly.

Meta-Knight