I am trying to remove a row from a DataGridView
I use two types of instances
VouchersDGV.Rows.Clear()
IN
If Not DGV.Rows(RowIndex).IsNewRow Then DGV.Rows.RemoveAt(RowIndex) DGV.Refresh() End If
Both from the inside out
VouchersDGV_RowValidating
Event I also fire it from another event handler using RaiseEvent.
The last event handler, I use it to escape from the inside of the string in case of incorrect input or ... what ever and bring the datagrid to its original position
Event -
Private Sub Supplier_prod_EscapeOnFirstRowPressed() Handles Me.EscapeOnFirstRowPressed
To remove a row, I enter the above EventHandler from
VouchersDGV_RowValidating
EventHandler and I return the same error
DGV.Rows.RemoveAt(0) {"Operation cannot be performed in this event handler."}
Personally, I can’t understand why this is happening and how I can give a solution.
Does anyone know about this error?
source share