Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my WPF App, I got a big problem for animation. I realizing fade out animation with code, but the code didn't understand the 'Completed' Method. CSharp can do with like this.

C#
anim.Completed += (s, _) => this.Close();


But the VB.NET can't got it.

Can you help me for write the answer please? :-)
Posted

1 solution

Use AddHandler to add event handlers in VB.NET;

VB
Dim anim As DoubleAnimation = New DoubleAnimation

Private Sub MySub()
  Dim anim As DoubleAnimation = New DoubleAnimation

  AddHandler anim.Completed, Sub(s, e) Me.Close()
  ' Or
  AddHandler anim.Completed, AddressOf MyEventHandlingFunction
End Sub

Private Sub MyEventHandlingFunction()
  Me.Close()
End Sub


Hope this helps,
Fredrik
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900