title: How to move by code the BindingSource to a specific record
body: <p>Using datagridview bound to BindingSource control bound to a <a href="http://en.wikipedia.org/wiki/Language_Integrated_Query#LINQ_to_SQL_.28formerly_called_DLINQ.29" rel="noreferrer">LINQ&nbsp;to&nbsp;SQL</a> class, I wonder how to position the bindingSource to a specific record, that is, when I type a Product name in a textbox, the bindingsource should move to that specific product. Here is my code:</p>
  
  <p>In my form FrmFind:</p>
  
  <pre><code>    NorthwindDataContext dc;
      private void FrmFind_Load(object sender, EventArgs e)
      {
          dc = new NorthwindDataContext();
  
          var qry = (from p in dc.Products
                     select p).ToList();
  
          FindAbleBindingList&lt;Product&gt; list = new FindAbleBindingList&lt;Product&gt;(qry);
  
          productBindingSource.DataSource = list.OrderBy(o =&gt; o.ProductName);
      }
  
      private void textBox1_TextChanged(object sender, EventArgs e)
      {
          TextBox tb = sender as TextBox;
  
          int index = productBindingSource.Find("ProductName", tb.Text);
  
          if (index &gt;= 0)
          {
              productBindingSource.Position = index;
          }
      }
  </code></pre>
  
  <p>In the program class:</p>
  
  <pre><code>    public class FindAbleBindingList&lt;T&gt; : BindingList&lt;T&gt;
      {
  
          public FindAbleBindingList()
              : base()
          {
          }
  
          public FindAbleBindingList(List&lt;T&gt; list)
              : base(list)
          {
          }
  
          protected override int FindCore(PropertyDescriptor property, object key)
          {
              for (int i = 0; i &lt; Count; i++)
              {
                  T item = this[i];
                  //if (property.GetValue(item).Equals(key))
                  if (property.GetValue(item).ToString().StartsWith(key.ToString()))
                  {
                      return i;
                  }
              }
              return -1; // Not found
          }
      }
  </code></pre>
  
  <p>How can I implement the find method to make it work?</p>