Hello,
I am trying to add basic scripting functionality to my .Net application. I am using MSScript Control for the scripting.
I want to add a list of varibles & its value to the script. I am not able to add a simple string variable to the script using AddObject method.
Lets say I have something like this.
public partial class Form1 : Form
{
public MSScriptControl.ScriptControlClass script = new MSScriptControl.ScriptControlClass();
public String amount = "120";
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
script.Reset();
object[] array = new object[] { };
String Code = "Sub Main() MsgBox Amount End Sub";
try
{
script.AddCode(Code);
script.AddObject("Amount", amount,true);
}
catch (System.Exception ex)
{
}
try
{
script.Run("Main", ref array);
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message + " " + script.Error.Description);
}
}
private void Form1_Load(object sender, EventArgs e)
{
this.textBox1.Text = "MsgBox \"We are on inVoice Screen\"";
script.AllowUI = true;
script.Language = "VBScript";
}
}
I get the error " Invalid procedure call or argument"
Any help will be greatly appreciated.
!--removed tag-->
Enter your message below
Sign in or Join us (it's free).