Refresh combo box in Windows Form VB.NET

Posted by fireBand on Stack Overflow See other posts from Stack Overflow or by fireBand
Published on 2010-05-06T18:52:40Z Indexed on 2010/05/06 18:58 UTC
Read the original article Hit count: 208

Filed under:

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.

© Stack Overflow or respective owner

Related posts about vb.net