title: Current cell cannot be set to an invisible cell in datagridview
body: <p>I am facing a problem in datagridview. I have done some code in keydown event for changing the tab focus but when tab reaches last of column it gives a error </p>
  
  <blockquote>
    <p>"Current cell cannot be set to an invisible cell".</p>
  </blockquote>
  
  <p>I have made last of cell is invisible because i don't want to be visible that cell.</p>
  
  <p>I have written following code in KeyDown event</p>
  
  <pre><code>private void m3dgvDepositDetails_KeyDown(object sender, KeyEventArgs e)
  {
    try
    {
      if (e.KeyCode == Keys.Tab &amp;&amp; notlastColumn)
      {
        e.SuppressKeyPress = true;
        int iColumn = m3dgvDepositDetails.CurrentCell.ColumnIndex;
        int iRow = m3dgvDepositDetails.CurrentCell.RowIndex;
        if (iColumn == m3dgvDepositDetails.Columns.Count - 1)
          m3dgvDepositDetails.CurrentCell = m3dgvDepositDetails[0, iRow + 1];
        else
          m3dgvDepositDetails.CurrentCell = m3dgvDepositDetails[iColumn + 1, iRow];
      }
    }
    catch (Exception ex)
    {
      CusException cex = new CusException(ex);
      cex.Show(MessageBoxIcon.Error);
    }
  }
  </code></pre>