|
-
Nov 9th, 2000, 10:58 PM
#1
Thread Starter
Addicted Member
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
-
Nov 10th, 2000, 02:14 AM
#2
Lively Member
Plz tell me exactly what run-time error you're talking about.
-
Nov 10th, 2000, 05:09 AM
#3
PowerPoster
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
-
Nov 10th, 2000, 06:05 AM
#4
transcendental analytic
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.
-
Nov 10th, 2000, 08:38 AM
#5
Thread Starter
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|