Hi,
Have a problem with using the ScriptControl under C#. I don't know if
this is more a C# problem or a Script problem so I try here first.
My problem is that when I add more than one sub to the script I get
the error:
Additional information: Expected 'Sub'
-----------------------------------
The script I'm using is:
Sub Temp(arg1)
MsgBox "The temperature is 16 degrees C."
End Sub
Sub Main(arg1)
MsgBox "The temperature is 15 degrees C."
End Sub
-----------------------------------
And I call i like this from C#
public void DoSomething()
{
object[] paramArray = new object[1];
Script script = new Script(this);
script.AddCode(Common.ReadTextFile(Application.StartupPath +
"\..\..\Logic.vbs"));
script.Run("Temp", ref paramArray);
}
-----------------------------------
If I remove one of them (which one doesn't matter) it works just fine.
I'm sure it's something simple I just have no idea what it is.
Can anyone help?
/Tony