delegate rerurning value?

S

Sonnich Jensen

Hi

How do I create a delegate like this, from component side?

bool AllowAction = true;
OnAskParentProgramme(this (sender), AllowAction);
if(AllowAction)
{
DoSomething();
}

in soft

OnAskParentProgramme(sender, AllowAction)
{
if this not ok....
AllowAction=false; // disallow
}


WBR
Sonnich
 
B

bradbury9

El miércoles, 10 de abril de 2013 10:22:25 UTC+2, Sonnich Jensen escribió:
Hi



How do I create a delegate like this, from component side?



bool AllowAction = true;

OnAskParentProgramme(this (sender), AllowAction);

if(AllowAction)

{

DoSomething();

}



in soft



OnAskParentProgramme(sender, AllowAction)

{

if this not ok....

AllowAction=false; // disallow

}





WBR

Sonnich

You should use a CancelEventArgs or create a new class that derives from it..

Check this link http://jmcilhinney.blogspot.com.es/2009/11/defining-and-raising-custom-events.html and search for ' if (!e.Cancel) ' I think it is just what you are looking for, hope it helps.
 
S

Sonnich Jensen

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top