Raising events ????

  • Thread starter Thread starter serge calderara
  • Start date Start date
S

serge calderara

Dear all,

I have a class wich is raising events as normally it
should do. having a form in the same assembly wich is
catching those events works fne. Raise events gets catch
normaly within the form and I can process what I want
based on them.

If I try to catch raised events by this class but within a
form located in a different assembly, I am not able to
catch them seems they are not raised or not coming until
the form eventhandler?

any idea why ?

my events are declared as follow in the assembly
Public Event AddCompleted()
Public Event DeleteCompleted()
Public Event UpdateCompleted()
Public Event Accepted()

regards
serge
 
I find our the problem.
sipply declare my event as public shared and they are trigged from
anywhere

regards
 
Well yes, but that may be more than you need. Shared events (or any shared
members for that matter) do not require an instance of your class to be
used. So imagine being able to wire an event procedure on a class that is
not even instanced.

A good example of this would be the Show method of the MessageBox class.
You don't have to make an instance of a MessageBox to be able to use its
Show method.

If you've solved your problem, great! But you should be able to access
events of a class from a different assembly without having to resort to
this. If the class is declared "WithEvents" then it will receive
notifications about the events that are raised for the base class:

Public WithEvents Button1 As System.Windows.Forms.Button
 
Because events get raised through the parent chain... if
your other form isn't in that chain... it will never see
the event get raised.... furthermore, if there is
processing that needs to happen at each level of parent,
you have a different set of issues... to make the event
visible beyond the first parent.......
 
Back
Top