Hi, I've been working on a custom control library for all my applications, but I also want it to be Open Source, so it needs to be easy to use.
I want to use the Me.Click event so when you click on Panel1
(Panel) or BtnText
(Label) it will raise the event Click
, but for some reason it doesn't let me use that event in RaiseEvent
.
Here's my code:
Public Sub BtnText_Click(sender As Object, e As EventArgs) Handles BtnText.Click
RaiseEvent Click()
End Sub
Public Sub Panel1_Click(sender As Object, e As EventArgs) Handles Panel1.Click
RaiseEvent Click()
End Sub
To propagate the event to the UserControl you can invoke the OnClick method:
Public Sub BtnText_Click(sender As Object, e As EventArgs) Handles BtnText.Click
Me.OnClick(e)
End Sub
Public Sub Panel1_Click(sender As Object, e As EventArgs) Handles Panel1.Click
Me.OnClick(e)
End Sub