我在[dgv_clients_UserDeletingRow]
使用[ContextMenuStrip]
.
它给了我这个错误:
Unable to cast object of type 'System.EventArgs' to type 'System.Windows.Forms.DataGridViewRowCanelEventArgs'
这是我的代码:
Private Sub dgv_clients_UserDeletingRow(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewRowCancelEventArgs) Handles dgv_clients.UserDeletingRow
deleteLine(e)
End Sub
Private Sub toolStripItem1_Click(ByVal sender As Object, ByVal args As EventArgs) Handles toolStripItem1.Click
If mouseLocation.RowIndex > 0 Then
dgv_clients.Rows(mouseLocation.RowIndex).Selected = True
dgv_clients.Rows(mouseLocation.RowIndex).DefaultCellStyle.SelectionBackColor = Color.Gray
DeleteToolStripMenuItem_Click(sender, args)
End If
End Sub
Public Sub DeleteToolStripMenuItem_Click(ByVal Sender As Object, ByVal e As EventArgs)
Call deleteLine(e)
End Sub
谢谢大家