Hi again,
Suppose you have a .NET class with an event:
Here's how you might handle the event in VBScript code:
Good luck!
Suppose you have a .NET class with an event:
publicclass Foo { publicevent EventHandler SomethingHappened; publicvoid MakeSomethingHappen() { if (SomethingHappened != null) SomethingHappened(this, new EventArgs()); } }
engine.AddHostObject("foo", new Foo()); engine.AddHostType("Console", typeof(Console)); engine.Execute(@" sub OnSomethingHappened(sender, args) Console.WriteLine(""Something just happened!"") end sub set connection = foo.SomethingHappened.connect(GetRef(""OnSomethingHappened"")) foo.MakeSomethingHappen() connection.disconnect() ");