2
Answers

Error in DatagridView CellEndEdit event

Ask a question
Ranjit Powar

Ranjit Powar

10y
3.9k
1
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)