I'm sorry. I should have stated Key events. I have also
tried keydown/up evnts. But I only seem to capture/raise
these events for the Enter key. I would like to
capture/raise the key events for the arrow up/down keys.
Right now I am exploring creating/adding a custom event
handler to the form for this.
Dim Event CustomEvent
Sub Form_Load...
AddHandler Me.CustomEvent, AddressOf CustomEventHandler
....
End Sub
Sub TestEvent()
RaiseEvent Me.CustomEvent
End Sub
Sub CustomEventHandler(...)
Debug.Writeline("Event Trapped")
End Sub
But how do I pass keystrokes to my custom event handler?
-----Original Message-----
Hi Steve,
Try using the KeyDown or KeyUp event. They have a broader
range of keys,including Up and Down arrows.
Hope this helps
Vikas
"Steve" <an*******@discussions.microsoft.com> wrote in
messagenews:65****************************@phx.gbl... What I really want to do is to raise the KeyPress event
of the Form or this datagrid control using the up or down
arrow keys. I have set the Form KeyPreview property to
true. The only key that seems to raise any Key events
is the Enter key. Is there any way to raise a Key event
witht the arrow keys?
>-----Original Message-----
>Hi,
>
>I want to determine which key was pressed in a control,
>like a datagrid. I see that in the currentcellchanged
>event of a datagrid I can capture keystroke events. I
>have tried someting like the following:
>
>Dim ky As New KeyPressEventArgs(Convert.ToChar(27))
>
>but this sets ky to the Escape key. I really want to
>capture the number that goes in Convert.ToChar(...).
How >can I capture that value?
>
>Thanks,
>Steve
>.
>
.