Hello
I want to add a double click event to my MonthCalendar object.
I just simulated double click by the following code:
Private Sub MonthCalendar1_MouseDown(ByVal sender As Object,
ByVal e As System.Windows.Forms.MouseEventArgs) Handles
MonthCalendar1.MouseDown
Dim x As Date
If e.Button = MouseButtons.Left Then
If m_NumClicks = 0 Then
m_FirstClick = x.Now.Ticks
m_NumClicks += 1
ElseIf (x.Now.Ticks - m_FirstClick) > 10000000 Then
m_NumClicks = 0
Else
m_NumClicks += 1
ExecuteDoubleClick()
End If
End If
End Sub
But I can't use my mousedown event anymore and this won't work for my click event.
I have already inherit my MonthCalendar into my class
Created a new event
Public Class MyMonthCalendar
Inherits MonthCalendar
Public Event MyDoubleClick(ByVal sender As Object, _
ByVal e As System.EventArgs)
Public Shadows Sub DoubleClick(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles
MyBase.DoubleClick
MessageBox.Show("DoubleClick")
End Sub
End Class
And on my form
Private Sub MonthCalendar1_MyDoubleClick(ByVal sender _
As Object, ByVal e As System.EventArgs) Handles _
MonthCalendar1.MyDoubleClick
MessageBox.Show("MonthCalendar1_MyDoubleClick")
End Sub
But I get no reaction on the double click.
Can anyone tell me what I'm doing wrong by creating my new event.
Thanks
karel.denaeghel@barco.com
I want to add a double click event to my MonthCalendar object.
I just simulated double click by the following code:
Private Sub MonthCalendar1_MouseDown(ByVal sender As Object,
ByVal e As System.Windows.Forms.MouseEventArgs) Handles
MonthCalendar1.MouseDown
Dim x As Date
If e.Button = MouseButtons.Left Then
If m_NumClicks = 0 Then
m_FirstClick = x.Now.Ticks
m_NumClicks += 1
ElseIf (x.Now.Ticks - m_FirstClick) > 10000000 Then
m_NumClicks = 0
Else
m_NumClicks += 1
ExecuteDoubleClick()
End If
End If
End Sub
But I can't use my mousedown event anymore and this won't work for my click event.
I have already inherit my MonthCalendar into my class
Created a new event
Public Class MyMonthCalendar
Inherits MonthCalendar
Public Event MyDoubleClick(ByVal sender As Object, _
ByVal e As System.EventArgs)
Public Shadows Sub DoubleClick(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles
MyBase.DoubleClick
MessageBox.Show("DoubleClick")
End Sub
End Class
And on my form
Private Sub MonthCalendar1_MyDoubleClick(ByVal sender _
As Object, ByVal e As System.EventArgs) Handles _
MonthCalendar1.MyDoubleClick
MessageBox.Show("MonthCalendar1_MyDoubleClick")
End Sub
But I get no reaction on the double click.
Can anyone tell me what I'm doing wrong by creating my new event.
Thanks
karel.denaeghel@barco.com