How can I prevent an event's parent version to be processed?

I have a function -with a common name- both in the child and in the parent form.
And I do NOT want the event (in the parent form) to be processed while the event in the child prossesing...
(hint : In VFP the equivalent phrase is 'NoDefault')
Thanks in advance.



Answer this question

How can I prevent an event's parent version to be processed?

  • EmilF

    Can you clarify   If you're using the class name when calling the function (e.g. class.SomeFunction()) this shouldn't happen, unless I'm not understanding your question.

    Josh

  • Stevoie

    Very thanks Blair. I know this thank is very late, but I was away for a long time from programming.
  • GBob

    huh

    function Or EventHandler
    virtual function

    huh

    this question makes no sense.

    should this question read ->

    "I have a virtual method in a class.
    When invoking the method in a derived class I do not want to run the process as defined in the parent class. . ."

    If so, just override and don't call the 'base':


    public class Parent
     {
          public virtual void DoSomething()
          {
             MessageBox.Show("Do Something In Parent");
          }
    }

    public class ChildInvokeParent
     {
          public override void DoSomething()
          {
             // this invokes the parents method first
             base.DoSomething();
             MessageBox.Show("Do Something In Child after doing it in parent");
          }
    }

    public class ChildNoInvokeParent
     {
          public override void DoSomething()
          {
             MessageBox.Show("Do Something In Child without invoking parent");
          }
    }

     

    but I have a feeling you are wanting to do something different. still I think you are looking at it backwards.





  • How can I prevent an event's parent version to be processed?