Click to See Complete Forum and Search --> : [RESOLVED] PDA Up/Down/eft/right buttons
T120
Jul 30th, 2007, 10:17 AM
How can I get a vb.net mobile app to respond to the PDA buttons?
The following code appears to work when deployed to emulation but not when deployed to the device:-
Private Sub App_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If (e.KeyCode = System.Windows.Forms.Keys.Up) Then
'Rocker Up
'Up
End If
If (e.KeyCode = System.Windows.Forms.Keys.Down) Then
'Rocker Down
'Down
End If
sapator
Jul 31st, 2007, 04:58 AM
Have a try with
e.keydata instead of e.keycode
Alternative you can try API. The keybd_event in coredll but i don't think you must complicate things without a reason.
<DllImport("coredll.dll", CharSet:=CharSet.Unicode)> _
Public Shared Sub keybd_event(ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)
End Sub
T120
Jul 31st, 2007, 08:10 AM
The event fires when in emulation mode but not when it is deployed to the device. I'm using compact framework 1 and that does not support keypreview on a form.
If I try on framework 2 (which does support keypreview) it works, but to upgrade the app. to 2 is a load of hassle I could do without.
sapator
Aug 1st, 2007, 01:25 AM
In a company i support they use CF 1 with key events on Smartphone 2003 so the keys most definitely work.
T120
Aug 1st, 2007, 02:38 AM
OK - solved it
The generated vb code for the keydown event was:-
Private Sub ABC_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
I changed it to :-
Private Sub ABC_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TabControl1.KeyDown
using the left right buttons changes the tab and using the up down buttons has the desired effect on the current tab.
I don't understand MYBASE anyway
Thanks for your advice and help
Regards
Barry
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.