Eae Eae - 2 months ago 9
Vb.net Question

Call a method with parameters

I want to call a method when an animation ends. I'm using this statement:

AddHandler anim.Completed, AddressOf anim_completed

But i want the anim_completed sub to be with parameters. Any ideas how to do that?


Simple solution. Use Anonymous Event Handler, then you will be able to access Ellipse object directly.

Dim target As Ellipse = Nothing

AddHandler anim.Completed, Sub()
                                If target IsNot Nothing Then

                                End If
                            End Sub