DateTimePicker Events don't fire

VS 2005 Beta2:

I like the DateTimePicker, but it seems the events don't fire, neither click, doubleclick, mouseclick, mousedoubleclick seem to fire.

Are these events not yet implemented, does one need to click at a particular location or do I do anything else wrong?

Thanks - Thomas

[296 byte] By [ThomasM] at [2008-2-15]
# 1

Please post some code that reproduces this so that we can diagnose this.

DavidM.Kean at 2007-9-7 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 2

There is no magic to the code:

The DateTimePicker is placed on a form by drag and drop. The designer declares it as follow:

Friend
WithEvents DateTimePicker1 As System.Windows.Forms.DateTimePicker

I assume when I click or doubleclick the DateTimePicker at least one of the messageboxes should show:

Private Sub DateTimePicker1_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs) Handles DateTimePicker1.DoubleClick, DateTimePicker1.Click
MessageBox.Show(
"DateTimePicker ClickEvent Fired")
End Sub

Private Sub DateTimePicker1_MouseEvent(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DateTimePicker1.MouseDoubleClick, DateTimePicker1.MouseClick
MessageBox.Show(
"DateTimePicker MouseEvent Fired")
End Sub
Thanks - Thomas

ThomasM at 2007-9-7 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 3
You're correct - these events don't work. The Windows Forms implementation is a wrapper on a Windows OS provided DateTimePicker control. The underlying control does special mouse capturing that prevents us from properly providing these events (we will hide them in the PropertyGrid for VS 2005).

As a work-around, try using MouseUp and MouseDown.

Joe

JoeStegman at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 4
Joe,

thanks for the confirmation - yes, mouseUp and Down work and I will use it as a workaround. Your information that the other events won't be available in the final release is very helpful too.

Thanks - Thomas

ThomasM at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms General...