title: Selecting a row of DataGridView programmatically
body: <p>In my form application, there is a (<code>buttonNEW</code>) that selects <code>NewIndexRow</code> of <code>DataGridView</code> and I want to change index of datagridview with this button.</p>
  
  <pre><code>private void buttonNew_Click(object sender, EventArgs e)
      {
          if (dataGridView.CurrentRow.Index!=dataGridView.NewRowIndex)
          {
              dataGridView.ClearSelection();
              dataGridView.Rows[dataGridView.NewRowIndex].Selected = true;
              label1.Text = dataGridView.CurrentRow.Index.ToString();
  
          }
      }
  </code></pre>
  
  <p>But after clicking the button the index of <code>DataGridView</code> does not change.
  What is the problem?</p>