新建一个类
public class MyTest
{
public MyTest()
{ text = ""; }
private string text;
public string MyText
{
get
{
return text;
}
set
{
text = value;
MessageBox.Show(text);
}
}
}然后我想在 MSScriptControl.ScriptControl中用
MyTest mClass= new ss.MyTest();
MSScriptControl.ScriptControl sc = new ScriptControlClass();
sc.Language = "JavaScript";
sc.AllowUI = true;
sc.AddCode(textBox1.Text); sc.AddObject("mClass", mClass, true); //到这提示 类型转换错误
object[] parameters = new Object[0];
sc.Run("hello", ref parameters);
public class MyTest
{
public MyTest()
{ text = ""; }
private string text;
public string MyText
{
get
{
return text;
}
set
{
text = value;
MessageBox.Show(text);
}
}
}然后我想在 MSScriptControl.ScriptControl中用
MyTest mClass= new ss.MyTest();
MSScriptControl.ScriptControl sc = new ScriptControlClass();
sc.Language = "JavaScript";
sc.AllowUI = true;
sc.AddCode(textBox1.Text); sc.AddObject("mClass", mClass, true); //到这提示 类型转换错误
object[] parameters = new Object[0];
sc.Run("hello", ref parameters);
[assembly: ComVisible(true)]