Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateTimePicker drop down calendar closure 1

Status
Not open for further replies.

MikeCt

Programmer
Nov 6, 2001
44
US
I'm using the DTPicker on my form. When the user enters a date that is is out of range I want to disable the DTPicker
till the the user presses the "OK" button on the message that appears. Problem is the Date entry part of the DTPicker is disabled with DTPicker.enabled = False, but the drop down calendar remains active which allows the user to still make changes. Is there a way to close the drop down calendar at runtime before disabling the DTPicker control.
Is there another calendar control that handles this better.

Thanks for any help
Mike
 
You could simulate pressing Escape which closes the drop down just before the disable.

Private Sub Timer1_Timer()

Timer1.Interval = 2000

If DTPicker1.Enabled Then
DTPicker1.SetFocus
Sendkeys "{ESC}", True
End If
DTPicker1.Enabled = Not DTPicker1.Enabled

End Sub
 
Thanks, This would be a simple fix but the program is running under windows7 which does not except the SendKeys command.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top