Results 1 to 5 of 5

Thread: Arrow keys, Problem..

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Posts
    217
    Here's my problem. I have a command button (cmdMoveNext) which is used to move through the recordset. I also have data in a datalist box. I coded in my cmdMoveNext_Click so if there was an error, throw up the error and the number. All is well when the user clicks the command button. But if the user uses the up and down arrows on the keyboard to move through the datalist, I get a run time error. I coded in the datalist_KeyPress, to call the cmdMoveNext_click. It's not working. I tried KeyUp, KeyDown, KeyPress, I dont know what else to try?? It just wont trap the errors using the keyboard strokes. Any Comments, thanks

  2. #2
    Lively Member Surgeon's Avatar
    Join Date
    Oct 2000
    Posts
    121
    Plz tell me exactly what run-time error you're talking about.

  3. #3
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Smile

    Jus use the KeyDown event to detect the arrow key is being press and put your code into a respective case,

    Code:
    Private Sub cmdMoveNext_KeyDown(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode
    Case vbKeyLeft
        '##Left arrow key##
        'Put your code here
    Case vbKeyRight
        '##Right arrow key##
        'Put your code here
    Case vbKeyUp
        '##Up arrow key##
        'Put your code here
    Case vbKeyDown
        '##Down arroy key##
        'Put your code here
    End Select
    End Sub

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Maybe the focus in on another control, you could capture the keypresses whatever control has the focus if you set keypreview to true on the form, then put the code for keydown on the form.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Posts
    217
    I know what I need to do. When the user clicks the down arrow, i need to run some validation before the cursor moves down in the list? Any idea? I've tried keyPress, Keydown, keyUp, FormKeyPreview set to true?

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