G
Guest
Hi
I've used the following code to intercept a KeyEvent into a DataGrid.
******************************************
Private Sub DataGrid1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles DataGrid1.KeyDown
' Check if F2 Key is pressed.
If e.KeyCode = Keys.F2 Then
' Key pressed, Show MsgBox
MsgBox("F2 Key pressed!", MsgBoxStyle.Exclamation, "Ok, event Intercepted")
End If
End Sub
******************************************
When the cursor is into a cell of my DataGrid, the MsgBox doesn't appear. If I select, by example, the caption text part of the DataGrid control and then I press F2 Key, the event is intercepted and MsgBox appear!
But I don't want it. I want intercept the event when the cursor is located into a cell of my DataGrid!
What should I do to intercept that event?
Thanks in advance
I've used the following code to intercept a KeyEvent into a DataGrid.
******************************************
Private Sub DataGrid1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles DataGrid1.KeyDown
' Check if F2 Key is pressed.
If e.KeyCode = Keys.F2 Then
' Key pressed, Show MsgBox
MsgBox("F2 Key pressed!", MsgBoxStyle.Exclamation, "Ok, event Intercepted")
End If
End Sub
******************************************
When the cursor is into a cell of my DataGrid, the MsgBox doesn't appear. If I select, by example, the caption text part of the DataGrid control and then I press F2 Key, the event is intercepted and MsgBox appear!
But I don't want it. I want intercept the event when the cursor is located into a cell of my DataGrid!
What should I do to intercept that event?
Thanks in advance