Capturing down-arrow key on Datagrid with IsInputKey()

R

Raymond Fenske

I am trying to capture the press of the down-arrow key on
a Datagrid. The online doc states that to accomplish this
I need to override IsInputKey() first, but I am unable to
get this to work. Does anyone have a working code sample?

Thanks
 
C

Craig Deelsnyder [MVP]

Here's the method I override to capture that:

Protected Overrides Function ProcessCmdKey(ByRef msg As
System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys)
As Boolean

Const WM_KEYDOWN As Integer = &H100
Const WM_KEYUP As Integer = &H101

If msg.Msg = WM_KEYDOWN Then
If msg.WParam.ToInt32() = CInt(Keys.Tab) Then
DataGrid1_KeyDown(Nothing, New KeyEventArgs(keyData))
Return True
End If
End If

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top