I'm trying to delete a row from a DataGridView
I use two types of instuctions
A
VouchersDGV.Rows.Clear()
B
If Not DGV.Rows(RowIndex).IsNewRow Then
DGV.Rows.RemoveAt(RowIndex)
DGV.Refresh()
End If
Both of them from inside of
VouchersDGV_RowValidating
Event
I also run it from another Event Handler with RaiseEvent.
The last Event handler I'm useing it to escape from inside of the row in case of wrong typing or... what ever and bring the datagrid to it's initial position
The Event is
Private Sub Supplier_prod_EscapeOnFirstRowPressed() Handles Me.EscapeOnFirstRowPressed
To delete the row I'm enter to above EventHandler from
VouchersDGV_RowValidating
EventHandler and I take back the same error
DGV.Rows.RemoveAt(0) {"Operation cannot be performed in this event handler."}
Personally I can't understand why that happen and how i can give a solution
Is there anybody to know about this error?