I am having unexpected difficulties reading the selected value from a
combobox.
I have a combobox that is bound to a datasource.
---snip---
sqlDALocation = new SqlCeDataAdapter(
"Select distinct col2 FROM Cartons",
DataBaseConnection);
sqlDALocation.Fill(sqlDSLocation, "Locations");
LocationFilter.DataSource = sqlDSLocation.Tables["Locations"];
LocationFilter.DisplayMember = "col2";
LocationFilter.ValueMember = "col2";
LocationFilter.DataBindings.Add("SelectedValue",
sqlDSLocation.Tables["Locations"],
"col2");
---snip---
Which currently correctly populates the combobox with 4 values.
When I try to read the current combobox value in the SelectedValueChanged
event
LocationFilter.SelectedValue.ToString();
It does not return the proper text in all/most cases. The first item in the
combobox is NEVER returned and the others are returned almost randomly.
I'm sure I'm doing something foolish or missing something obvious. I would
appreciate any help someone can provide.
Thanks,
John Kelsey