1
Cell enter - Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function
如果我這樣做的錯誤會出現這樣的:單元格中輸入 - 操作是無效的,因爲它會導致重入調用SetCurrentCellAddressCore功能
Private Sub dg1_CellEnter(sender As Object, e As DataGridViewCellEventArgs) Handles dg1.CellEnter
if e.columnindex = 4
if dg1.CurrentRow.Cells("id").Value = 0
dg1.endEdit(true)
msgbox("choose any item in cell3 before you can proceed here")
dg1.CurrentCell = dg1.CurrentRow.Cells(3)
exit sub
end
'my code here . . .
end if
End Sub
我只是想阻止用戶進入或執行我的代碼在cell 4
如果她/他 沒有選擇在cell 3
任何物品。當用戶選擇cell 3
的cells("id")
將有一個價值取決於cell 3
值的id的項目。但是當我點擊cell 4
時總會出現錯誤。
任何人都可以解決這個問題?在此先感謝