I have bind the combobox using dataset. Displaymember and value member.
My value member is integer and display member is string.In runtime i want to find the value of valuemember. My valuemember have 1,24,34,56,..
i am giving 56 and the corresponding value to be selected
CBClay Burch Syncfusion Team April 12, 2002 11:15 PM
This discussion assumes you have your combobox bound to a dataview. If you are using a datatable, then you can use the DefaultDataView member of the datatable as the DataSource for your combobox.
In this DataView case, the combobox's Items member is a collection of DataRowViews. We can use these DataRowViews to get the corresponding DisplayMember if we know the ValueMember, and vice versa.
The next comment is that the FindString and FindStringExact work only with the DisplayMember. So, they will not help you in looking for a ValueMember. Our solution is to add a public method to a derived combobox that does a 'FindStringExact' except that it looks at the ValueMember of the DataRowView instead of the DisplayMember. Below are some code snippets.
public class MyComboBox : ComboBox
public int FindExactValueMember(object find)
return FindExactValueMember(find, 0);
public int FindExactValueMember(object find, int start)
for (int i = start; i < this.Items.Count; ++i)
DataRowView drv = this.Items[i] as DataRowView;
if(drv != null && find.Equals(drv[this.ValueMember]))
int index = comboBox1.FindExactValueMember(56);
if(index > -1) comboBox1.SelectedIndex = index;