[英]keydown event Does not work on forms but does work on Datagridview in Vb.net
Keydown事件不適用於form1,但適用於datagrid。 但是我希望它僅在form1上工作。 如果我注釋了datagrid Keydown事件中的行,則仍在form1中的事件不起作用。 有人可以幫我嗎? 這只是一個示例代碼。datagridview在表單中停靠。
Private Sub form1_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown
If ((e.KeyCode = Keys.Z) AndAlso e.Control) Then
MsgBox("hello")
End If
End Sub
Private Sub DataGrid_KeyDown(sender As Object, e As KeyEventArgs) Handles DataGrid.KeyDown
If ((e.KeyCode = Keys.Z) AndAlso e.Control) Then
MsgBox("hello")
End If
End Sub
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.