Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
171 | Apr 11,2002 07:34 PM UTC | Apr 13,2002 04:15 AM UTC | WinForms | 1 |
![]() |
Tags: FAQ |
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])) return i; } return -1; } } //.... //usageint index = comboBox1.FindExactValueMember(56); if(index > -1) comboBox1.SelectedIndex = index;
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.