VB call to JScript method returns method's source 
Author Message
 VB call to JScript method returns method's source

Hello,

In IE5, If I call a JScript method from a VB code, the return value is a
string containing the source code of the JScript method itself!

For example

JScript::

    function MyObj() {
            //...
            this.theMethod = myMethod;
    }

    function myMethod() { return true; }

VB: (somehow has a ref to the above object):

    Dim res as Variant
    res = jsObj.theMetod()

now the res is a string: "function myMethod() { return true; }".

However if I pass an argument, it works.

    res = jsObj.theMethod(Null)

Does anybody have a rationale?

regards,
--VS.



Fri, 19 Apr 2002 03:00:00 GMT  
 VB call to JScript method returns method's source

When you call a jscript method (which is always a function), you must include the ()'s even if no arguments are passed.  You use the ()'s in the sample VB code here, but I'd guess that in the real code you didn't.  If you omit the ()'s then you'll get exactly what you describe.

--
Michael Harris


  Hello,

  In IE5, If I call a JScript method from a VB code, the return value is a
  string containing the source code of the JScript method itself!

  For example

  JScript::

      function MyObj() {
              //...
              this.theMethod = myMethod;
      }

      function myMethod() { return true; }

  VB: (somehow has a ref to the above object):

      Dim res as Variant
      res = jsObj.theMetod()

  now the res is a string: "function myMethod() { return true; }".

  However if I pass an argument, it works.

      res = jsObj.theMethod(Null)

  Does anybody have a rationale?

  regards,
  --VS.



Fri, 19 Apr 2002 03:00:00 GMT  
 VB call to JScript method returns method's source


Fri, 19 Jun 1992 00:00:00 GMT  
 VB call to JScript method returns method's source
I tried to cancel this message but the server didn't allow it. Could anybody
help, please?

regards,
--VS.



Sat, 20 Apr 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. JScript call Java Applet method which return an array

2. Returning several recordsets/simple variables from a VB method

3. Calling a method in a vb dll from html page - newbie question

4. Can't call Methods

5. Calling methods of an aggregated objects' interface

6. Can't call Methods

7. Call WScript's methods from a component

8. Calling COM methods from VBScript or JScript?

9. calling java methods from jscript

10. Calling jscript method from java applet

11. Problem calling a COM method from JScript

12. Calling ActiveX methods from JScript?

 

 
Powered by phpBB® Forum Software