Results 1 to 7 of 7

Thread: Raise events in places

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Raise events in places

    Hi.

    hmm trying to grasp this once again.

    I have:

    MainForm

    subclasses


    I want the mainform to raise an event so the subclasses can "hear it" and act upon it.

    I know how to do this for the Mainform, so when an event is raised in the subclasses, the UI gets called and acts upon it. No doubt it shouldnt be different and I've tried to "reverse" the way so that the subclasses can hear the event but not going to plan.

    This is what I have:

    MainForm:

    Code:
    public delegate void SendNewNotification(MyClass notification)
    public event SendNewNotification OnEventSendNewNotification;

    subclass:

    Code:
    public delegate void SendNewNotification(MyClass notification)
    public event SendNewNotification OnEventSendNewNotification;
    MainForm.SendNewNotification theNewNotification;
    
    ..
    ..
    ..
    
    this.OnEventSendNewNotification += new SendNewNotification(Myclass2_OnEventSendNewNotification) //it also inserts this event method in this class for me to do my own thing
    this.theNewNotification = new MainForm.SendNewNotification(OnEventSendNewNotification);


    When time comes for the UI to raise this event, how do I do it? Everytime I try to do it "if (this.OnEventSendNewNotification != null){}" it always tells me it is null therefore it wont raise the event.
    Last edited by Techno; May 10th, 2006 at 10:35 PM.

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width