Windows Script Components  

<event> Element

Declares the name of a custom event that can be fired from within the script component.

<event name="name" dispid="dispid"/>


The name of an event being exposed.
(Optional) A numeric value specifying the dispatch ID for the event, which is compiled into the component's type library and then used by the host application to bind to events. If you do not specify a dispatch ID, it is assigned automatically to the event when the type library is created. Specifying your own dispatch ID allows you to make sure the dispatch ID for an event is always the same, even if you recreate the type library. It also allows you to map your event to a specific dispatch ID, such as those used by convention in COM. For more details, see Exposing Events.


To fire an event, use the fireEventmethod.


The following script component fragment defines two events (namechanged and querydone) and shows how to fire one of them (namechanged).

Note   A CDATA section is required to make the script in the <script> element opaque. For details, see Script Component Files and XML Conformance.
   <property name="name">
   <event name="namechanged"/>
   <event name="querydone" dispid="22"/>

<script language="VBScript">
var gName
Sub get_lowercaseName()
   get_lowercaseName = name
End Sub

Sub put_lowercaseName(newLCName)
   gName = newLCName
End Sub

See Also

<method> Element | <property> Element | Exposing Events | Exposing Methods | Exposing Properties | fireEvent Method