.NET ComboBox Value Assignment notes

Recently i’ve encountered issue on assigning a value on ComboBox.   I’ve propagated the combobox value on the collection and I was assuming that everything will work as it is.

this.cboAvailableOnlyTallyTH.Text = this_particular_string; //this one is not working

this.cboAvailableOnlyTallyTH.SelectedText = this_particular_string; //this one is also not working

this.cboAvailableOnlyTallyTH.SelectedValue = this_particular_string; //this one is also not working

So frustrating that i’m really wondering why the value wont be assigned as i’m expecting. Later i realised that there are some extra spaces on the values which the string wont match.  I’ve finally fixed the issue by using the assignment statement .

this.cboAvailableOnlyTallyTH.SelectedIndex = this.cboAvailableOnlyTallyTH.FindString(this_particular_string;






Leave a Reply

Your email address will not be published. Required fields are marked *