Events from a SmartPart to the ShellForm

Topics: CAB & Smart Client Software Factory
Jul 12, 2006 at 4:00 AM
originally posted by: MyKey0815

I have some problems with the EventPublication/Subcription

Here the code of the SmartPart (UserControl)

<SmartPart()> _
Partial Public Class OLMenu
Inherits UserControl

<EventPublication("event://OLMenuMain_Click", PublicationScope.Global)> _
Public Event OLMenuMain_Click As EventHandler

Private Sub olOLMenuMain_Click(ByVal sender As Object, ByVal e As vbAccelerator.Components.ListBarControl.ItemClickedEventArgs) Handles olOLMenuMain.ItemClicked
RaiseEvent OLMenuMain_Click(sender, e)
End Sub

End Class


The Code of the ShellForm.vb is:

<EventSubscription("event://OLMenuMain_Click", Thread:=ThreadOption.UserInterface)> _
Private Sub OLMenuMain_Click(ByVal sender As Object, ByVal e As EventArgs)

MsgBox("Hallo Event")
'CallByName(Me, NameOfMethode.Data, CallType.Method)
End Sub


My Question: Why the event not raise in the ShellForm? Is that the wrong place?
Jul 13, 2006 at 2:18 AM
originally posted by: MyKey0815

I have found the misstake: I have in the subcription of the event the wrong access modifier

Wrong Part:

<EventSubscription("event://OLMenuMain_Click", Thread:=ThreadOption.UserInterface)> _
Private Sub OLMenuMain_Click(ByVal sender As Object, ByVal e As EventArgs)


Correct Part:

<EventSubscription("event://OLMenuMain_Click", Thread:=ThreadOption.UserInterface)> _
Public Sub OLMenuMain_Click(ByVal sender As Object, ByVal e As EventArgs)


Now it works