M
Martin
Hi all,
I'm having a problem when trying to raise an event in my custom control when
a toolstripbutton enable state changes. The problem is that although the
code to raise the event executes, my handler never see it.
This executes when the button enable state changes:-
Private Sub OnPrintToolStripButton_EnabledChanged(ByVal sender As Object,
ByVal e As System.EventArgs)Handles PrintToolStripButton.EnabledChanged
RaiseEvent PrintToolStripButton_EnabledChanged(sender, e)
End Sub ' This doesn't raise an event
When I step through the code, the raiseevent line executes but the debugger
doesn't jump to my handler.
If however, I raise the exact same event, but from a button click event,
then it works as expected and the event handler is run.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
RaiseEvent PrintToolStripButton_EnabledChanged(sender, e)
End Sub ' This raises the event ok
This is my event handler code:
Private Sub MyControl_PrintToolStripButton_EnabledChanged(ByVal sender As
Object, ByVal e As System.EventArgs) Handles
MyControl.PrintToolStripButton_EnabledChanged
Me.Menu_Print.Enabled = MyControl.PrintToolStripButton.Enabled
End Sub
Has anyone encountered anything similar, or is able to point out my obvious
mistake?
Thanks for your time and kind regards,
Martin.
I'm having a problem when trying to raise an event in my custom control when
a toolstripbutton enable state changes. The problem is that although the
code to raise the event executes, my handler never see it.
This executes when the button enable state changes:-
Private Sub OnPrintToolStripButton_EnabledChanged(ByVal sender As Object,
ByVal e As System.EventArgs)Handles PrintToolStripButton.EnabledChanged
RaiseEvent PrintToolStripButton_EnabledChanged(sender, e)
End Sub ' This doesn't raise an event
When I step through the code, the raiseevent line executes but the debugger
doesn't jump to my handler.
If however, I raise the exact same event, but from a button click event,
then it works as expected and the event handler is run.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
RaiseEvent PrintToolStripButton_EnabledChanged(sender, e)
End Sub ' This raises the event ok
This is my event handler code:
Private Sub MyControl_PrintToolStripButton_EnabledChanged(ByVal sender As
Object, ByVal e As System.EventArgs) Handles
MyControl.PrintToolStripButton_EnabledChanged
Me.Menu_Print.Enabled = MyControl.PrintToolStripButton.Enabled
End Sub
Has anyone encountered anything similar, or is able to point out my obvious
mistake?
Thanks for your time and kind regards,
Martin.