i have databound a combo box to a column in a table like so:
when the value of comboBox7 is changed i want to populate a second combo box.
when i try to grab the value of the combobox7 i cant.
i have placed this code in both the
SelectionChangeCommitted and the SelectionChanged methods, like so:
the problem is that in when i try to get the selected text in the SelectionChanged method i get this error
"index and length must refer to a location within the string"
when i try to get the selected in the SelectionChanged method, i simply get an empty string. whats the problem here?
Code:
this.comboBox7.DataSource = ds.Tables["treatment_main"];
this.comboBox7.DisplayMember = "main_cat";
when the value of comboBox7 is changed i want to populate a second combo box.
when i try to grab the value of the combobox7 i cant.
i have placed this code in both the
SelectionChangeCommitted and the SelectionChanged methods, like so:
Code:
ComboBox cb = (ComboBox) sender;
string d = cb.SelectedText;
the problem is that in when i try to get the selected text in the SelectionChanged method i get this error
"index and length must refer to a location within the string"
when i try to get the selected in the SelectionChanged method, i simply get an empty string. whats the problem here?