Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

ComboBox.Items.Count = 0 When Datasource.Count > 0

$
0
0

I have a routine is VB that I use to populate ComboBox controls whose DataSouce can change over time.

Private Sub SetupcbDataSource(ByVal cb As ComboBox, ds As List(Of ValPtr))
        cb.DataSource = Nothing
        cb.Items.Clear()
        cb.DataSource = ds
        cb.DisplayMember = STR_Value' = "Value" the name of one of the properties in ValPtr
        cb.ValueMember = STR_Pointer' = "Pointer" another property name in ValPtr
End Sub
It has worked flawlessly until now.  ONE ComboBox refuses to work.  In debug mode (VS 2010), I can see that the DataSource is set correctly and contains 5 instances of ValPtr.  However, CB.Items.Count is always 0.  This does not happen to any other ComboBox.  I've deleted the offending ComboBox, copied another working ComboBox and it still happens.  I don't know where else to look to correct this behavior.


ebassador
"Find it, fix it, move on."


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>