Populating a Combobox from a Dictionary
Hey, I am trying to get my Combo box to populate itself with stuff from a dictionary I created in another class. I tried to link it with the DataSource property but its empty. Any ideas how to do this? Thanks in advance
Answers (2)
1
Dictionary<int, string> myDictionary;
// populate dictionary
cmbDate.DataSource = New BindingSource(myDictionary, null)
cmbDate.DisplayMember = "Value"
cmbDate.ValueMember = "Key"
0
If there is no data in the DataSource then of course there will be no data in the ComboBox.