BUG: Client-Side Events Do Not Execute in VBScript (192151)



The information in this article applies to:

  • Microsoft Visual InterDev 6.0

This article was previously published under Q192151

SYMPTOMS

When using Design-Time Controls (DTCs) that ship with Visual InterDev 6.0, the client-side events will not execute if they are being called using VBScript and the client (that is, browser) JScript.dll is version 3.x.

CAUSE

The DTCs that ship with Visual InterDev 6.0 require the client machine to have the JScript.dll version 4.0 or later when using VBScript to handle the DTC events. This is caused by the DTCs underlying use of the Script Object Library that ships with Visual InterDev 6.0.

RESOLUTION

There are several workarounds:
  • Use the advise() method to associate your VBScript function with the event. The following example associates the VBScript procedure Recordset1_ondatasetcomplete() with the "ondatasetcomplete" event of the Recordset1 object.
        <SCRIPT FOR="window" EVENT="onload" LANGUAGE="JavaScript">
        Recordset1.advise("ondatasetcomplete", Recordset1_ondatasetcomplete());
        </SCRIPT>
    
        <SCRIPT Language=VBScript>
    
          Sub Recordset1_ondatasetcomplete()
            '-- Event Handler Code --
          End Sub
        </SCRIPT>
    						
  • Call the VBScript procedure with a JScript event. The Event Handler "wrapped" in JScript would look like:
        <SCRIPT Language=VBScript>
    
          Sub Recordset1_ondatasetcomplete_VBS()
            '-- Event Handler Code --
          End Sub
        </SCRIPT>
    
        <SCRIPT Language=JScript>
          function Recordset1_ondatasetcomplete() {
            Recordset1_ondatasetcomplete_VBS()
          }
        </SCRIPT>
    						
  • The event handler could also be rewritten entirely in JScript, which will work even if the client is running version 3.x of the JScript.DLL.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

REFERENCES

Please refer to the following site for the latest information on Microsoft's scripting engines:

Modification Type:MinorLast Reviewed:3/7/2005
Keywords:kbBug kbCtrl kbScript KB192151