VB.net Programmable DateTimePicker Drop

Hi everyone, I have this code here:

Call SendMessage(dtPicker.Handle, CB_SHOWDROPDOWN, True, 0&)

This works great in combobox, but doesn't seem to work when it comes to the DateTimePicker field.

What could be the problem?

Thank!

David

0
source share
1 answer

No, this is for ComboBox. Native DTP control is quite a nod. It supports the DTM_CLOSEMONTHCAL message to close the calendar, but does not have a corresponding message to open it. You will need to do something ugly, like a mock mouse or keyboard input. The latter is probably best:

Private Sub ShowMonthCalendar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ShowMonthCalendar.Click
    DateTimePicker1.Focus()
    SendKeys.Send("{F4}")
End Sub
+8
source

All Articles