Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: VBScript ByRef arguments cannot seem to get to work.

0
0
Sorry I added a item to the issues, but probably should have been posted here instead..

Great Library, really helpful!

I ran into one situation where we have some existing VBScripts, the have subroutines and functions that take ByRef scalar types such as ints, double and the values are being changed in the function.


Here is the code I tested:
    VBScriptEngine scriptEngine = new VBScriptEngine(WindowsScriptEngineFlags.EnableDebugging);
    double byRefValue = 10.0;
    scriptEngine.Execute(@"sub TestSub(ByRef MyParam) : MyParam=20.0 : end sub");
    scriptEngine.Script.TestSub(ref byRefValue);

Basically what I was trying to accomplish , was the double values should end up being set to 20.0 , but it always remains at 10.0

I tried changing the double to an object and dynamic and it didn't make a difference.

Any thoughts on how to support this scenario.

Thanks!

Viewing all articles
Browse latest Browse all 2297