Hi ....

I want to add a new rows when cell leave event occurs.It shows error like Operation can not be performed in this event handler...

here is my code,

If PatientDataGridView.CurrentCell.ColumnIndex = 2 Then
End If

Member Avatar

why add a row when the current cell is located in the 3 column?
first of all this should be trigger like this:

Private Sub DataGridView1_CellLeave(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellLeave
        If e.ColumnIndex = 2 Then
        End If
    End Sub