• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 166
  • Last Modified:

simple VB problem !!!

VB has Date Picker Control
For Date Inputs....right

problem is that
i want Enter Key
to be used
intstead of the
default TAB key
for Focusing a control

Private Sub Form_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then
  SendKeys vbTab
End If

End Sub

the above code work well
in all type of contols
but fails to respond
for Date Picker Control

if you have any clue
plz share

1 Solution
Many ActiveX control do not recognize the keypress events event if the forms Keypreview property is set to True. Write the same code in keypress event of the DateControl also. Example:
Private Sub DateControl_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
 SendKeys vbTab
End If
End Sub
Well, to set the focus to the date thing, just use setfocus:


that's it!

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now