添加完成后右击选择属性,嵌入互操作类型改成false。
ScriptControl mytool = new ScriptControl(); //data和data1值由c#导入VBscript string code = "dim data "+ "\r\n" + "data = " + data; string code1 = "dim data1 " + "\r\n" + "data1 = " + data1; mytool.AddCode(code); mytool.AddCode(code1); //运行textBox1中代码 string s = textBox1.Text; mytool.ExecuteStatement(s); string rst = "Result"; string rst1 = "name(1)"; object result = mytool.Eval(rst); //结果查询 object result2 = mytool.Eval(rst1); //结果查询
textbox1控件中文本
VBscript脚本
dim mm,Result dim name(1) Result=0 mm = data mn = data1 if mm = 1 and mn = 1 then Result= true else Result= false end if if mn = 1 then name(1)=true else name(1)=false end if
辛苦学会怎么用,发现该脚本只适用32位平台,64位暂未找到解决方法
原文:https://www.cnblogs.com/dfxf/p/13631276.html