VB6 WithEvents in C#?

C

Chua Wen Ching

Hi there.

I search google that i can use delegate and events to
replace WithEvents.. but i had 1 vb6 sample code.. which i
not sure how to code it in c#

Code:
====
private WithEvents ParA as EngineParSystem

private Sub ParA_NewPar(VelocX as Single, VelocY as
Single, VelocZ as Single)

LifeS = CurrentLifeT

End Sub

So how to code delegates and event with that in c#?

Any help?

Thanks.

Regards,
Chua Wen Ching
 
M

Mattias Sjögren

Code:
====
private WithEvents ParA as EngineParSystem

private Sub ParA_NewPar(VelocX as Single, VelocY as
Single, VelocZ as Single)

LifeS = CurrentLifeT

End Sub

So how to code delegates and event with that in c#?


private EngineParSystem ParA;

....

ParA.NewPar += new SomeEventHandlerType(ParA_NewPar);



Mattias
 
M

Mattias Sjögren

new SomeEventHandlerType(ParA_NewPar);

--> if not mistaken the SomeEventHandler is named by me..

It should be the delegate type of the NewPar event.

..(ParA_NewPar)

--> i would need to code in c#

private void ParA_NewPar(float VelocX, float VelocY, float
VelocZ)

right?

Right!



Mattias
 

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