Operation is not valid because it results in a reentrant call to the...

  • Thread starter Thread starter rassiel
  • Start date Start date
R

rassiel

Guest
Hi, I want to my this code to works. When a user ends editing a cell I want the grid to automatically move to the next cell. I tried this code:

Private Sub m_dtgControlTiempos_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles m_dtgControlTiempos.CellEndEdit

Dim nextIndex As Integer = Math.Min(m_dtgControlTiempos.ColumnCount - 1, m_dtgControlTiempos.CurrentCell.ColumnIndex + 1)
m_dtgControlTiempos.CurrentCell = m_dtgControlTiempos.CurrentRow.Cells(nextIndex)
m_dtgControlTiempos.BeginEdit()
End Sub

but it throws me an exception: Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function

If I change the variable nextIndex for a integer literal it works.

Any solution?

Continue reading...
 
Back
Top