Results 1 to 5 of 5

Thread: [RESOLVED] PDA Up/Down/eft/right buttons

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Location
    Devon - UK
    Posts
    214

    Resolved [RESOLVED] PDA Up/Down/eft/right buttons

    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:-

    Code:
        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

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: PDA Up/Down/eft/right buttons

    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.

    Code:
     <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
    Last edited by sapator; Jul 31st, 2007 at 05:02 AM.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Location
    Devon - UK
    Posts
    214

    Re: PDA Up/Down/eft/right buttons

    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.

  4. #4
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: PDA Up/Down/eft/right buttons

    In a company i support they use CF 1 with key events on Smartphone 2003 so the keys most definitely work.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Location
    Devon - UK
    Posts
    214

    Re: PDA Up/Down/eft/right buttons

    OK - solved it

    The generated vb code for the keydown event was:-
    Code:
    Private Sub ABC_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
    I changed it to :-
    Code:
        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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width