Refresh combo box in Windows Form VB.NET
- by fireBand
Following is the code to populate combobox using DataSource
Dim CountryList As Array = MyCtrl.GetAllCountries
With cbCountyList
.DataSource = CountryList
.DisplayMember = "CountryName"
.ValueMember = "CountryID"
End With
After adding a new COuntry Name to Database I want to reflect the changes in combobox. Repeating this code is not an option becasue it triggers SelectIndexChange event and had to do some crappy work around to avoid that.
So I was wondering if there is way to refresh the combobox list. I actually thought binding with the DataSource property supposed to do it automatically. I also tried
cbCountyList.Refresh()
Thanks in advance.