Hello Dave,
Thanks for your response. The following sample suppose that you the
DateTimePicker is of "Short" format(12/25/2003 ) and it post mouse click
messages to the begining of the control (x=6, y=6) so that the month (12)
will be selected whenever it got focus.
'-------------------------------code snippet----------------------------
Declare Auto Function PostMessage Lib "user32" Alias "PostMessageA"
(ByVal hwnd As IntPtr, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal
lParam As Int32) As Int32
Public Const MK_LBUTTON = &H1
Public Const WM_LBUTTONDOWN = &H201
Public Const WM_LBUTTONUP = &H202
Private Sub DateTimePicker1_GotFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles DateTimePicker1.GotFocus
Dim lParam As Int32
lParam = 393222 ' equals to C code "MAKELPARAM(6,6)"
PostMessage(DateTimePicker1.Handle(), WM_LBUTTONDOWN, MK_LBUTTON,
lParam)
PostMessage(DateTimePicker1.Handle(), WM_LBUTTONUP, 0, lParam)
End Sub
'--------------------------------end of-------------------------------------
Please check it on your side.
Have a nice day!
Regards,
HuangTM
Microsoft Online Partner Support
MCSE/MCSD
Get Secure! --
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.