title: I want to detect if the DataGridView cell leaves the event only in selecting mode
body: <p>I am trying to detect the <code>DataGridViewCell</code> leave event only in selecting mode not in the editing Mode in C#. That is the code given below is shows here:</p>
  
  <pre><code>      private void dgv_CellLeave(object sender, DataGridViewCellEventArgs e)
        {
                if (dgvC.CurrentCell.ColumnIndex == 0)
                {
                    if (dgv.CurrentCell.Value == null)
                        MessageBox.Show("You have to enter somthing");
                }
        }
  
      private void dgv_CellEndEdit(object sender, DataGridViewCellEventArgs e)
      {
                if (dgv.CurrentCell.ColumnIndex == 0)
                {
                    if (dgv.CurrentCell.Value.ToString() !="S" )
                        MessageBox.Show("You have to enter S");
                }
  
   }
  </code></pre>
  
  <p>The above to events work properly when I am selecting the grid cell, but they don't work while editing the cell. Means in both the cases the leave event is occuring. So i wants to detect the current cell is in editing mode or Selecting mode and after that i have to place cursor in the same cell,that should not be changed. Can any one tell me how can I do it?  </p>