Most host applications can receive Windows® Script Component events as they do any other events. However, some host applications require some setup before they can receive script component events.
Note If you are creating a Behavior script component, events are exposed using the DHTML object model. For details, see Exposing Custom Events in Behavior Script Components.
In Visual Basic, for example, you must use early (compile-time) binding to the component in order to receive events. Early binding requires a type library, so you must have generated a type library for the script component. For details, see Creating a Script Component Type Library. In addition, when you declare the object variable for the component, you must specify the WithEvents keyword. (The class name used in the Dim statement is the ID that you assigned in the script component's <component> element.)
An example in Visual Basic might look like this:
Dim WithEvents Scriptlet1 as MyScriptlet Set Scriptlet1 = CreateObject("MyScriptlet") Sub Scriptlet1_namechanged MsgBox("Value of name property changed") End Sub