title: Previous button not working for DataGridView C#
body: <p>How can I fix the previous button to move backward in dataGridView row?
  The next button is working.
  It does nothing.
  I don't know how to fix that. Any ideas? I  would appreciate it.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>int nRow;
  
  private void Form1_Load
  {
      nRow = DataGridView2.CurrentCell.RowIndex;
  }
  
  private void PreviousData_Click
  {
      if (row&gt;=0)
      {
          if (row!=0)
          {
              DataGridView2.Rows[row].Selected = false;
              DataGridView2.Rows[--row].Selected = true;
          }
          else
          {
              MessageBox.Show("Need More Data!");
          }
      }
  }
  
  int row;
  
  private void DataGridView2_CellClick
  {
      if (DataGridView2.SelectedRows.Count != -1)
      {
          row = DataGridView2.CurrentRow.Index;
      }
  }
  </code></pre>