|
-
Nov 17th, 2000, 01:05 PM
#1
Thread Starter
Addicted Member
my program has about fourty text boxes. when the users presses enter, i want the focus to move to the next text box. how could i do this?? the only part i can't figure out it how to move to the next control in the tab order?
i could do it by hard coding the name of the next text box, but would like to do it by tab order.
thanks
-
Nov 17th, 2000, 01:07 PM
#2
Fanatic Member
-
Nov 17th, 2000, 01:16 PM
#3
Hyperactive Member
In the KeyPress event of all forty text boxes, add:
Code:
If KeyAscii = 13 Then
KeyAscii = 0
SendKeys "{TAB}"
End If
-
Nov 17th, 2000, 02:53 PM
#4
Thread Starter
Addicted Member
-
Nov 17th, 2000, 07:52 PM
#5
Addicted Member
Set the KeyPreview property of the form to true, and then use jmcswain's code in the KeyPress event of the form instead.
-
Nov 20th, 2000, 09:44 AM
#6
Hyperactive Member
but won't that remap the Enter Key for command buttons and other controls that you might not want to remap?
-
Nov 20th, 2000, 01:12 PM
#7
Addicted Member
You can use the tag property of the control to identify if the enter key behaviour for that control is to be remapped or not. The code would then look something like this:
Code:
If KeyAscii = 13 Then
If Me.ActiveControl.Tag = "" Then
KeyAscii = 0
SendKeys "{Tab}"
End If
End If
-
Nov 20th, 2000, 02:55 PM
#8
Hyperactive Member
Damn, I should have thought of that. Nice and elegant.
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
|