Well, I was translating a C# into VB.NET
using developer fusion, and the API didn't translated me that part...
owner.IsVisibleChanged += delegate
{
if (owner.IsVisible)
{
Owner = owner;
Show();
}
};
I know that += is for AddHandler owner.IsVisibleChanged, AdressOf (delegate??)
, so, which is the equivalent for that part?
Thanks in advance.
PD: I don't enough money for buy .NET Reflector :( And I wasted the trial.
There are two parts here.
Anonymous methods. delegate
in C# roughly corresponds to an anonymous Sub
in VB here.
Adding event handlers. +=
in C#, AddHandler
in VB.
Putting it together:
AddHandler owner.IsVisibleChanged, _
Sub()
…
End Sub
Incidentally, the AddressOf
operator you’ve mentioned is used in VB to refer to a (non-anonymous) method without calling it. So you would use it here if you would refer to an existing, named method rather than an anonymous method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With