Passing on a raised event

J

Just Me

A control on a UserControl has it's mouseup event raised.

I want the usercontrol to pass it on.

That is , I want the form containing the UserControl to receive a MouseUp
event from the UserControl.


Do I have to define an event in the user control and raise it in the
controls MouseUp event, or is there a neater way?

If I have to define an event, can I call it MouseUp?


Thanks
 
K

Ken Tucker [MVP]

Hi,

You have to shadow the event and raise it manually. This example
will raise the mousemove event when the mouse moves over a textbox in the
user control.

Public Shadows Event MouseMove(ByVal sender As Object, ByVal e As
MouseEventArgs)



Private Sub TextBox1_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseMove

RaiseEvent MouseMove(sender, e)

End Sub



Ken

-----------------------

A control on a UserControl has it's mouseup event raised.

I want the usercontrol to pass it on.

That is , I want the form containing the UserControl to receive a MouseUp
event from the UserControl.


Do I have to define an event in the user control and raise it in the
controls MouseUp event, or is there a neater way?

If I have to define an event, can I call it MouseUp?


Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top