I am trying to run VBScripts at runtime using a C# .NET Application. I am able to get data from the VBScript using object arrays and pass data to it using .AddObject(,,) method.
However, in passing different data types to the script, it's behaving in a curious way: It accepts Int32 type objects from .net but when i try to pass .net strings, I need to use the format ObjectName.ToString wherever i reference the string object
in my VBScript code.
Here is a sample of the C# code I am using:
//scriptText holds the vb script to run
ScriptControl sc = new ScriptControl();
sc.Language = "VBScript";
sc.AddObject("Argument", "Hi", true);
object obj = sc.Eval("Main()");
Here is a sample VB Script which should work but doesn't:
'Argument - passed to the VBScript
Output(0) = Argument 'Pass the argument
Main = Output
and the vb script which works :
View Complete Post