VB6 WithEvents in C#?

  • Thread starter Thread starter Chua Wen Ching
  • Start date Start date
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
 
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
 
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
 
Back
Top