From: Tony Johansson on
Hi!

Here is some code. But the code marked with * below how would that
//Create a delegete
public delegete void MyEventHandler(object sender, EventArgs e);

//Create an event member
public event MyEventHandler MyEvent;

//Invoke the delegete within a method when you need to raise the event, as
the following code demonstrates

if(MyEvent != null)
MyEvent((this, EventArgs.Empty)

EventArgs e = new EventArgs();

if (handler != null)
handler(this, e);



From: Arne Vajhøj on
On 30-05-2010 10:31, Tony Johansson wrote:
> Here is some code. But the code marked with * below how would that
> //Create a delegete
> public delegete void MyEventHandler(object sender, EventArgs e);
>
> //Create an event member
> public event MyEventHandler MyEvent;
>
> //Invoke the delegete within a method when you need to raise the event, as
> the following code demonstrates
>
> if(MyEvent != null)
> MyEvent((this, EventArgs.Empty)
>
> EventArgs e = new EventArgs();
>
> if (handler != null)
> handler(this, e);

I do not see the * !?!?

Arne
From: Tony Johansson on
"Arne Vajh�j" <arne(a)vajhoej.dk> skrev i meddelandet
news:4c027933$0$274$14726298(a)news.sunsite.dk...
> On 30-05-2010 10:31, Tony Johansson wrote:
>> Here is some code. But the code marked with * below how would that
>> //Create a delegete
>> public delegete void MyEventHandler(object sender, EventArgs e);
>>
>> //Create an event member
>> public event MyEventHandler MyEvent;
>>
>> //Invoke the delegete within a method when you need to raise the event,
>> as
>> the following code demonstrates
>>
>> if(MyEvent != null)
>> MyEvent((this, EventArgs.Empty)
>>
>> EventArgs e = new EventArgs();
>>
>> if (handler != null)
>> handler(this, e);
>
> I do not see the * !?!?
>
> Arne

Sorry

I mean these lines.
if (handler != null)
handler(this, e);

//Tony



From: Arne Vajhøj on
On 30-05-2010 11:09, Tony Johansson wrote:
> "Arne Vajh�j"<arne(a)vajhoej.dk> skrev i meddelandet
> news:4c027933$0$274$14726298(a)news.sunsite.dk...
>> On 30-05-2010 10:31, Tony Johansson wrote:
>>> Here is some code. But the code marked with * below how would that
>>> //Create a delegete
>>> public delegete void MyEventHandler(object sender, EventArgs e);
>>>
>>> //Create an event member
>>> public event MyEventHandler MyEvent;
>>>
>>> //Invoke the delegete within a method when you need to raise the event,
>>> as
>>> the following code demonstrates
>>>
>>> if(MyEvent != null)
>>> MyEvent((this, EventArgs.Empty)
>>>
>>> EventArgs e = new EventArgs();
>>>
>>> if (handler != null)
>>> handler(this, e);
>>
>> I do not see the * !?!?
>
> Sorry
>
> I mean these lines.
> if (handler != null)
> handler(this, e);

Should handler be MyEvent or ?

Arne

From: Willem van Rumpt on
On 30-5-2010 16:31, Tony Johansson wrote:

>
> if(MyEvent != null)
> MyEvent((this, EventArgs.Empty)
>

this wouldn't even compile...

> EventArgs e = new EventArgs();
>
> if (handler != null)
> handler(this, e);

....and what's to rewrite about this?
What's the actual source, and what's the actual problem you're having?

--
Willem van Rumpt