title: How to force datagridviewcell to end edit when row header is clicked
body: <p>I am trying to force the <code>DataGridViewCell</code> to exit out of the edit mode when a user clicks the row header that's in the same row as the cell being edited. For the record, editmode is set to EditOnEnter.</p>
  
  <p>So I write the following event accordingly:</p>
  
  <pre><code>private void dGV_common_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
  {
      dGV_common.EndEdit();   
  } 
  </code></pre>
  
  <p>The above code didn't force the cell to end the edit mode. While the below code forces the cell to exit from editmode:</p>
  
  <pre><code>    private void dGV_common_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
      {
          dGV_common.EndEdit();   
          dGV_common.CurrentCell = null;
      }
  </code></pre>
  
  <p>It also deselects the entire row, which is not the desired behavior when a user clicks on the <code>RowHeader</code>. </p>
  
  <p>So, my work around has been the following:</p>
  
  <pre><code>private void dGV_customer_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
  {
      dGV_customer.EndEdit();
      dGV_customer.CurrentCell = null;
      dGV_customer.Rows[e.RowIndex].Selected = true;
  }
  </code></pre>
  
  <p>Which works well when you select a single row header, but fails when you try to select multiple row headers by holding shift.</p>
  
  <p>How can I properly handle this situation?</p>