In a windows forms project, I have several combo boxes. The first combo box contains a list of objects. Those objects then have several lists which are used as the datasource's for the successive combo boxes, depending on which item is chosen in the first.
When the first item is selected, the other combo boxes update correctly. When this item is changed a second time (or any successive time), the other combo boxes do not correctly update. When debugging, it shows that the other combo boxes are having their datasource assigned correctly, with the right 'count' of items. But the items aren't actually displaying. What could be the cause?
Private Sub cmbPackage_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbPackage.SelectedIndexChanged
// The Package controls what other options are available.
If (TypeOf (cmbPackage.SelectedItem) Is Package) Then
// Set current package as a member object to see if it was a scoping issue
_currentPackage = CType(cmbPackage.SelectedItem, Package)
ClearOptionDropdowns()
cmbReward.DataSource = _currentPackage.Rewards
cmbPayment.DataSource = _currentPackage.PaymentTypes
cmbCommMethod.DataSource = _currentPackage.CommunicationMethods
cmbBillMethod.DataSource = _currentPackage.BillMethods
cmbNotification.DataSource = _currentPackage.BillNotifications
cmbReward.Refresh()
cmbPayment.Refresh()
cmbCommMethod.Refresh()
cmbBillMethod.Refresh()
cmbNotification.Refresh()
...
...
End Sub
Private Sub ClearOptionDropdowns()
cmbReward.DataSource = Nothing
cmbPayment.DataSource = Nothing
cmbCommMethod.DataSource = Nothing
cmbBillMethod.DataSource = Nothing
cmbNotification.DataSource = Nothing
' Also had x.items.clear(), but removed to see if that was affecting it
End Sub