Userform - Move to next textbox field by hitting enter instead
Hi Gary
i just have a question here. how come i can hit enter to move between text
boxes on my form?
There is no commandbutton with Default=true on your form. Those hijack
Enter.
i don't have any code, other than to limit number entry to
a couple of fields.
the EnterKeyBehavior is set to false, which means enter moves the focus to
the next object in the tab order.
I believe it's there to prevent lineshifts in strings where those aren't
wanted. They might as well use the discarded Enters for something useful.
Just guessing.
now, when i get to a frame with checkboxes, enter does nothing and tab
moves
to the next checkbox.
Enter makes no meaning to most other objects, there is no lineshift in a
checkbox. You can write code for it in the same way, either to Tab on
Private Sub CheckBox1_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then KeyCode = 9
End Sub
or to toggle value
Private Sub CheckBox2_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then CheckBox2.Value = Not CheckBox2.Value
End Sub
or whatever you need
Private Sub CheckBox3_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then Call InstallLinux
End Sub
HTH. Best wishes Harald
|