使用OCX复杂问题
用C#开发WEB应用,使用OCX控件相关问题,请各位大侠指点.
我把我要加的控件 在 项目--添加引用 里加入了
并且在 工具箱 的 组件 里可以看到,也能正常托到 窗口中,
然后定义并创建,代码如下.
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected LUCENTLib.Lucent Lucent1;
private void Page_Load(object sender, System.EventArgs e)
{
//int i;
Lucent1 = new LUCENTLib.LucentClass();
// 在此处放置用户代码以初始化页面
}
}
但在给控件属性付值时出现
[COMException (0x8000ffff): 灾难性故障]
System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData) +457
LUCENTLib.LucentClass.set_Passwd(String ) +0
不知为何,请指点,
另外,怎样才能处理OCX控件的事件.
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.TextBox1.TextChanged += new System.EventHandler(this.TextBox1_TextChanged);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
是在上面的申明里加吗?希望可位给OCX事件实用个列子,不胜感激.