• 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

0
aejaz
Asked:
aejaz
1 Solution
 
SethiCommented:
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
0
 
Avatar-XCommented:
Well, to set the focus to the date thing, just use setfocus:

datePicker1.setFocus

that's it!
0

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