When a Visual Basic ActiveX control fires an event that is handled in script, changes that are made to the event's ByRef parameters are not passed back to the control.
↑ Back to the top
The default OLE Automation Marshaller cannot convert a strongly-typed ByRef parameter into a ByRef Variant, so it converts the parameter into a normal ByVal Variant, and passes that to the scripting engine.
↑ Back to the top
To allow Visual Basic Script (VBScript) event handlers to change parameter values of events that are fired by Visual Basic ActiveX controls, declare the parameters as ByRef Variants. JScript event handlers are only able to change the values of these ByRef Variants if they contain Object references, because JScript passes all variables by value (not by reference), in accordance with the ECMA-262 specification.
↑ Back to the top
Many of the controls that are included with Visual Basic have events that use strongly-typed (nonvariant) ByRef parameters. For example, the Microsoft DataGrid Control has a ByRef Cancel parameter for its BeforeColUpdate event.
Due to their popularity in Visual Basic, these controls are also widely used in Web pages. Most of these controls, however, were not designed for this environment, and you should consider this limitation before you use any of these controls in a scripting context.
↑ Back to the top
For additional information, click the article number below
to view the article in the Microsoft Knowledge Base:
269258�
INFO: JScript Passes Variables by Value
↑ Back to the top