Advertisement

Question with VBscript

Started by August 21, 2000 12:09 PM
3 comments, last by SeanHowe 24 years, 4 months ago
How do I make it so a function in vbscript takes an object as a parameter?
Can you post a code snippet?

Epolevne
Advertisement

Remember, there is only one data type in VBScript: VARIANT.

    '' no need to specify the TYPE of the parameter'' as it can only be a VARIANT, and the data'' the VARIANT encapsulates will be resolved'' at run time.. so watch runtime errors! <img src="smile.gif" width=15 height=15 align=middle>''sub sub1( object1, object2 )    object1.method    object2.methodend sub'' function always returns VARIANT so'' no need to specify return typefunction func1( object1, object2 )    object1.method        if object2.property == "Yes" then        func1 = True    else        func1 = False    end ifend function    



HTH ..
if object2.property == "Yes" then 


Been coding a little too much C++ recently? hehe...that should be a VBScript equals comparison operator (=), not C/C++ (==). I''m sure you know, but the devil''s in the details.

Epolevne

quote:
Been coding a little too much C++ recently? hehe...that should be a VBScript equals comparison operator (=), not C/C++ (==). I''m sure you know, but the devil''s in the details.


doh! You got me!

This topic is closed to new replies.

Advertisement