G
Guest
Hi,
I have a combo box that is bound AFTER a user makes a selection from another
unbound drop down. The problem is, the SelectedIndex of the combo box is
always initialized to 0, not -1. This makes it difficult to determine
whether an item was selected or not, since the items collection is Zero based
also. Additionally, in the code that does the binding, when i set the
Datasource, Valuemember and DisplayMember properties, the SelectedIndexChange
AND SelectedValueChange events always fire...given the above two issues, this
makes it difficult to work with the combobox and i fear i am forced to head
back to the old days when i had to set a member variable flag to distinguish
between when i am initializing a combo box and when the user actually is
making a selection...very nasty and backwards. Any ideas on whether this is
a bug or whether this is my issue? the code to initialize the Combo box is
als follows (i am using VS2005 beta):
cbExchange.DataSource = DbConnection.instance.getDbTable(
"StockExchange" );
cbExchange.ValueMember = "exchange_id";
cbExchange.SelectedIndex = -1;
cbExchange.DisplayMember = "symbol";
I have a combo box that is bound AFTER a user makes a selection from another
unbound drop down. The problem is, the SelectedIndex of the combo box is
always initialized to 0, not -1. This makes it difficult to determine
whether an item was selected or not, since the items collection is Zero based
also. Additionally, in the code that does the binding, when i set the
Datasource, Valuemember and DisplayMember properties, the SelectedIndexChange
AND SelectedValueChange events always fire...given the above two issues, this
makes it difficult to work with the combobox and i fear i am forced to head
back to the old days when i had to set a member variable flag to distinguish
between when i am initializing a combo box and when the user actually is
making a selection...very nasty and backwards. Any ideas on whether this is
a bug or whether this is my issue? the code to initialize the Combo box is
als follows (i am using VS2005 beta):
cbExchange.DataSource = DbConnection.instance.getDbTable(
"StockExchange" );
cbExchange.ValueMember = "exchange_id";
cbExchange.SelectedIndex = -1;
cbExchange.DisplayMember = "symbol";