Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

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

$
0
0
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?


Viewing all articles
Browse latest Browse all 2535

Trending Articles