Click here to Skip to main content
16,005,389 members
Home / Discussions / C#
   

C#

 
GeneralRe: Invalidate wont actually do what I need to do Pin
Guffa23-Aug-06 9:54
Guffa23-Aug-06 9:54 
AnswerRe: Invalidate wont actually do what I need to do Pin
Nader Elshehabi20-Aug-06 1:28
Nader Elshehabi20-Aug-06 1:28 
GeneralRe: Invalidate wont actually do what I need to do Pin
Ista20-Aug-06 6:44
Ista20-Aug-06 6:44 
QuestionError in report ... [modified] Pin
mostafa_h19-Aug-06 9:25
mostafa_h19-Aug-06 9:25 
QuestionCancelEventHandler? Pin
Dominik Reichl19-Aug-06 8:15
Dominik Reichl19-Aug-06 8:15 
AnswerRe: CancelEventHandler? Pin
leppie19-Aug-06 11:00
leppie19-Aug-06 11:00 
GeneralRe: CancelEventHandler? Pin
Dominik Reichl19-Aug-06 22:35
Dominik Reichl19-Aug-06 22:35 
GeneralRe: CancelEventHandler? Pin
Vitaliy Tsvayer20-Aug-06 1:47
Vitaliy Tsvayer20-Aug-06 1:47 
You could also do something like this:

public class TestCancellableEvents
{
    public static void Main()
    {
         TestClass test = new TestClass();
         test.MyEvent += new MyDelegate(test_MyEvent);
         test.MyEvent += new MyDelegate(test_MyEvent2);

         test.doit();
 }

     void test_MyEvent2(object sender, CancelEventArgs args)
     {
        //do nothing this won't be called
     }

     void test_MyEvent(object sender, CancelEventArgs args)
     {
         //Cancel event, so the following handlers in the chain won't be called
         args.Cancel = true;
     }

 public class CancelEventArgs
 {
     bool cancel = false;

     public bool Cancel
     {
         get { return cancel; }
         set { cancel = value; }
     }
 }

 public delegate void MyDelegate(object sender, CancelEventArgs args);
 public class TestClass
 {
     public event MyDelegate MyEvent;

     public void doit()
     {
         Delegate[] list = MyEvent.GetInvocationList();
         CancelEventArgs args = new CancelEventArgs();
         foreach (MyDelegate handler in list)
         {
             handler(this, args);
             if (args.Cancel)
             {
                 break;
             }
         }
     }
 }


Vitaliy Tsvayer
Tikle

GeneralRe: CancelEventHandler? Pin
leppie20-Aug-06 2:21
leppie20-Aug-06 2:21 
GeneralRe: CancelEventHandler? Pin
Vitaliy Tsvayer20-Aug-06 3:20
Vitaliy Tsvayer20-Aug-06 3:20 
GeneralRe: CancelEventHandler? Pin
leppie20-Aug-06 3:35
leppie20-Aug-06 3:35 
Questionhelp me Pin
Tahir Shah19-Aug-06 7:16
Tahir Shah19-Aug-06 7:16 
AnswerRe: help me Pin
Colin Angus Mackay19-Aug-06 8:11
Colin Angus Mackay19-Aug-06 8:11 
QuestionAdding a tab Pin
kalyanPaladugu19-Aug-06 5:50
kalyanPaladugu19-Aug-06 5:50 
AnswerRe: Adding a tab Pin
Stefan Troschuetz19-Aug-06 5:53
Stefan Troschuetz19-Aug-06 5:53 
AnswerRe: Adding a tab Pin
User 665819-Aug-06 6:07
User 665819-Aug-06 6:07 
Questionworld 2003 Pin
TAREQ F ABUZUHRI19-Aug-06 4:56
TAREQ F ABUZUHRI19-Aug-06 4:56 
AnswerRe: world 2003 Pin
Nader Elshehabi20-Aug-06 2:07
Nader Elshehabi20-Aug-06 2:07 
GeneralRe: world 2003 Pin
TAREQ F ABUZUHRI20-Aug-06 4:00
TAREQ F ABUZUHRI20-Aug-06 4:00 
GeneralRe: world 2003 Pin
Nader Elshehabi20-Aug-06 6:18
Nader Elshehabi20-Aug-06 6:18 
QuestionProblem with excel 97 Pin
AnnnS19-Aug-06 2:50
AnnnS19-Aug-06 2:50 
AnswerRe: Problem with excel 97 Pin
Rob Graham19-Aug-06 3:06
Rob Graham19-Aug-06 3:06 
AnswerRe: Problem with excel 97 Pin
Ista19-Aug-06 16:21
Ista19-Aug-06 16:21 
AnswerRe: Problem with excel 97 Pin
Nader Elshehabi20-Aug-06 2:20
Nader Elshehabi20-Aug-06 2:20 
QuestionDirectShow Programming in C# for Mpeg-2 Demultiplexer Pin
Andy Rama19-Aug-06 0:39
Andy Rama19-Aug-06 0:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.