M
Marty Cruise
I have a custom collection which contains instances of a
custom class. With me so far?
OK, now I set the datasource of a combobox to the
collection, having overridden the ToString() function of
the custom class to return one of its text properties.
Life is good.
The first of two problems involves the combobox showing
the first item in the collection. To get around this,
I've added a dummy class with a null text property, and a
tag that equals 0. Question one: is there a better way
to have the combobox default to nothing following
databinding to my collection?
The second problem: After populating the combobox by
setting its datasource to the collection, I want to
specify the selected item (if one exists) by pointing it
to a class which has been populated on the side that is
not contained in the collection, but is identical to one
which it contains. I want to achieve:
cmbCustomers.selecteditem = myJob.Customer
Am I dreaming, or is there a way to do this without
having to implement a 'For i' loop with a lot of CType-
ing?
custom class. With me so far?
OK, now I set the datasource of a combobox to the
collection, having overridden the ToString() function of
the custom class to return one of its text properties.
Life is good.
The first of two problems involves the combobox showing
the first item in the collection. To get around this,
I've added a dummy class with a null text property, and a
tag that equals 0. Question one: is there a better way
to have the combobox default to nothing following
databinding to my collection?
The second problem: After populating the combobox by
setting its datasource to the collection, I want to
specify the selected item (if one exists) by pointing it
to a class which has been populated on the side that is
not contained in the collection, but is identical to one
which it contains. I want to achieve:
cmbCustomers.selecteditem = myJob.Customer
Am I dreaming, or is there a way to do this without
having to implement a 'For i' loop with a lot of CType-
ing?