Q:

How do I create search like excel in DataGridView?

I used this code to search in DataGridView to find and select a row (no filter)! But, when DataGridView has repetitive values in rows it won't get the next row! How do I go to the next row with every click to Btn_find (Find similar to Excel)?
private void button1_Click(object sender, EventArgs e)
{
    button1.Text = "Find Next";

    foreach (DataGridViewRow row in dataGridView1.Rows)
    {
        if (row.Cells["ProductId"].Value == null)
        {
            continue;
        }
        if (row.Cells["ProductId"].Value.ToString().Trim() == textBox1.Text)
        {
            dataGridView1.CurrentCell = row.Cells["ProductId"];
            dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.Rows[row.Index].Index;
            return;
        }
    }
} 

A:

The idea:

Add a private field to the class as an index to remember which row you last found.
Reset this index if the search text is changed. (Optional)
Iterate through all rows, beginning with the row following the last successful search. If no results were found last search, start at the beginning.

Implementation:
private int searchIndex = -1;

private void button1_Click(object sender, EventArgs e)
{
  button1.Text = "Find Next";

  for (int i = 0; i < dataGridView1.Rows.Count; i++)
  {
    searchIndex = (searchIndex + 1) % dataGridView1.Rows.Count;
    DataGridViewRow row = dataGridView1.Rows[searchIndex];

    if (row.Cells["Foo"].Value == null)
    {
      continue;
    }
    if (row.Cells["Foo"].Value.ToString().Trim() == textBox1.Text)
    {
      dataGridView1.CurrentCell = row.Cells["Foo"];
      dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.Rows[row.Index].Index;
      return;
    }
  }
}

private void textBox1_TextChanged(object sender, EventArgs e)
{
  searchIndex = -1;
}

Why these changes?

for (int i = 0; i < dataGridView1.Rows.Count; i++)

Still iterate through every row.

searchIndex = (searchIndex + 1) % dataGridView1.Rows.Count;

Start at row[searchIndex + 1].  When we reach the last row, mod (%) returns us to the first row.

private void textBox1_TextChanged(object sender, EventArgs e)
 {
   searchIndex = -1;
 }

Start back at the beginning of the list when new search criteria are entered.  This is optional.

