How can I check if an event will be raised in VB.NET? I seem to be able to do it in C#, but not in VB, even though I'm using the same syntax.
Here's my VB.NET syntax (which returns an error)
If [EVENT] IsNot Nothing Then
If([EVENT] != null) //If an event is not null(nothing)
"[EVENT] is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event."
You have to use a strange and little known part of VB.Nets syntax which is that if you add
Event to the end of an Events name it exposes the object in the same way as c# does so if you have an event
Foo you can check if there are handlers with
If FooEvent IsNot Nothing Then End If