I have in my project a DataGridView with 7 Cells (columns) and one row.
When I'm leaving the last cell i want to do two things A) write the data in a SQL table and B) delete the current row in order to bring the control to its initial state.
As for the write issue that is goes well but when I'm truing to delete the row the program returns me the error of "{"Operation cannot be performed in this event handler."} ".
the comand of deleting the row is the following.
Now the major issue is coming.
When I'm in the 7nth cell i press the escape button on my keyboard and the program deletes the row without any problem, using of course the same instruction.
BUT When I'm trying to do the same procedure automatically (throu my code) it returns me the above error.
I give my instruction from the CellEnter event of course when I'm going into.
I'm stack here. I don't know what is going on. Is there anybody to give me a piece of assistance?
When I'm leaving the last cell i want to do two things A) write the data in a SQL table and B) delete the current row in order to bring the control to its initial state.
As for the write issue that is goes well but when I'm truing to delete the row the program returns me the error of "{"Operation cannot be performed in this event handler."} ".
the comand of deleting the row is the following.
VB.NET:
If Not DGV.Rows(RowIndex).IsNewRow Then
DGV.Rows.RemoveAt(RowIndex)
DGV.Refresh()
End If
When I'm in the 7nth cell i press the escape button on my keyboard and the program deletes the row without any problem, using of course the same instruction.
BUT When I'm trying to do the same procedure automatically (throu my code) it returns me the above error.
I give my instruction from the CellEnter event of course when I'm going into.
I'm stack here. I don't know what is going on. Is there anybody to give me a piece of assistance?