我有以下代码:
Private Sub myGrid_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles myGrid.KeyDown
If e.KeyCode = Keys.Divide AndAlso e.Control Then
Dim response = MsgBox("are you sure to delete a record?", vbYesNo)
If response = vbYes Then
//Delete the record
End If
End If
End Sub
这有效(对于Ctrl+ /),但问题是这适用于任何不同于-
. 如果我指定 Keycode 是 Keys.Subtract (使用Ctrl+ -)它永远不会被抓住!