Cor said:
Hi Santhosi,
You have to declare your event "public"
I hope this helps?
Public is actually irrelevent. The event keyword(in C# anyway, don't see VB
being that different) is specifically used over a plain delegate type
because it restricts outside classes from raising or clearing the event,
otherwise a plain delegate would suffice. This creates an event in the
assembly, this event has two required methods (add and remove in C#, .addon
and .removeon in IL) that performs the addition and removal of a delegate
from the event. Even when the event is declared as a field underneath it is
a property with a backing delegate field(compiler handles that). Because of
this, an event type *never* directly provides access to the backing
delegate, in fact code has no way to actually get to the backing delegate
because of the nature of events.
Now, there is a raise accessor defined by the CLI spec, specifically .fire
in IL, but the recommendation is for that accessor to be protected and it
isn't surfaced in C# and VB(AFAIK). This accessor doesn't have a restriction
that it *must* be protected, to my knowledge, and if you use a language that
allows public raise accessors, it will be possible to raise the event from
another class, otherwise you are basically out of luck(note, C# doesn't
consume raise accessors in my experience).
It really is simplier to simply write a method to do what you want(thats
basically all a raise accessor is, after all).