Click event

  • Thread starter Thread starter James
  • Start date Start date
J

James

I am designing a complexcontrol. It has a user designed control
(child) within a user designed control(parent). If a click event
occurs in the child how do I detect it in the parent?
 
Hello James,
I am designing a complexcontrol. It has a user designed control
(child) within a user designed control(parent). If a click event
occurs in the child how do I detect it in the parent?

The easiest way would be to create a Click Event in the child and let
the parent act on it.

In Child:
Public Event Click()

Private Sub MyControl_Click(ByVal Sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Click
RaiseEvent Click()
End Sub

In Parent:
Dim ThisControl As MyControl

Private Sub ThisControl_Click() Handles ThisControl.Click
'Place your code here
End Sub

Best regards,

Martin
 
Back
Top