Ranjit Powar

Ranjit Powar

  • 272
  • 6.3k
  • 1.4m

Error in DatagridView CellEndEdit event

Mar 31 2014 1:44 AM
There is datagridview in my project and i write some code cellEndEdit event but when I type in  cell and click on next cell it raises error  as "Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function."



        private void dgvQuotation_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
             
            if (dgvQuotation.CurrentCell.ColumnIndex == 0)
            {
                dgvQuotation.CurrentCell = dgvQuotation.CurrentRow.Cells[2];
                dgvQuotation.CurrentRow.Cells[1].Value = 0;
               // dgvQuotation.CurrentRow.Cells[3].Value = 0;
                dgvQuotation.CurrentRow.Cells[3].Value = 0;
                dgvQuotation.CurrentRow.Cells[4].Value = 0;
                return;
            }
         }

Answers (2)