title: How do I get the previously selected cell in a DataGridView cell click event
body: <p>I have a DataGridView and I am allowing only one column to be able to be selected.<br>
  I did this by checking, in the <code>CellClick</code> event, if the <code>ColumnHeader</code> for the selected cell matches, and, if it doesn't, I will clear the selection.<br>
  However, I want to make it that it will return to the previously selected cell if they selected a cell in the wrong Column. How can I do that?  </p>
  
  <p>I tried storing the selected cell object but thats not going to work because the moment the <code>CellClick</code> event fires, the selected cell object will change.</p>
  
  <p>Also, for some reason my clear selection doesn't work everytime I click the wrong cell, especially if I click it really fast the wrong cell will still stay selected, for your info the DataGridView <code>CellClick</code> event is added dynamically during runtime and there are multiple DataGridView controls.  </p>
  
  <p>My code I can't provide the way I use to populate the DataGridView because it is really long.  </p>
  
  <pre><code>  private void Form1_Load(object sender, EventArgs e)
    {
        DGV.CellClick += new DataGridViewCellEventHandler(DGV_CellClick);
    }
  
    void DGV_CellClick(Object sender, EventArgs e)
    {
        DataGridView dgv = (DataGridView)sender;
        // DataGridViewCell Selectedcell = dgv.SelectedCells[0];
        if (!dgv.Columns[dgv.SelectedCells[0].ColumnIndex].HeaderText.Contains("SCORE"))
            dgv.ClearSelection();
    }
  </code></pre>