Cor <no*@non.com> wrote:
Can you try this (needs only to open the ide, start a VB project and paste
it in, and set the start in your properties to sub main), and then give
comments, I did it in VB, because there was my answer based on.
This was the question
I have an event declared in class1.
Now i want to raise the event in the my class2 or anywhere other than
class1.
Is it possible? If so how?
This was my answer
You have to declare your event "public"
You don't have to declare the event public in order to *raise* the
event. You have to declare the event public in order to *subscribe* to
(or unsubscribe from) it.
The reason your code allows other classes to raise the events is
because you've *also* given a sayhello method. It would be possible to
give that method without the Hello event being public, in which case
only the class could subscribe to the event, but anyone could raise it
(indirectly, via the method call).
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too