title: DataGridView- How to jump to the selected row in search?
body: <p>I use the following code to find a row in DataGridView and highlight the row. </p>
  
  <pre><code>private void btnSearch_Click(object sender, EventArgs e)
      {
          currentMode = ModeSelection.Search;
  
          if (cmbSearchBy.SelectedIndex == Convert.ToInt16(SearchBy.MaterialID))
          {
              dgvSearchResults.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
              int rowIndex = -1;
              try
              {
                  foreach (DataGridViewRow row in dgvSearchResults.Rows)
                  {
                      if (row.Cells[1].Value.ToString().Equals(materialLocation.MaterialID))
                      {
                          //Select the row here
                          rowIndex = row.Index;
                          dgvSearchResults.Rows[rowIndex].Selected = true;
                          break;
                      }
                  }
              }
              catch (Exception ex) { throw ex; }
          }
  </code></pre>
  
  <p>It works perfectly. Problem is my DataGridView has over 500 records and if the selected row is near the bottom of the DataGridView, users have to scroll all the way down to the bottom. Which code can I use to jump to the row that I am looking for? Any help will be very much appreciated!</p>