引发类型为“System.Windows.Forms.AxHost+InvalidActiveXStateException”的异常。
时间:2008-12-27
来源:互联网
我用asp写的一个网页,中间加入一个activeX控件,但出现了以上异常,在后台c#中的代码如下,请高手指教!
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows;
using AxGeoUrban3DWebLib;
public partial class _3D : System.Web.UI.Page
{
public AxGeoUrban3DWebLib.AxGeoUrban3DWeb axGeoUrban3DWeb1;
protected void Page_Load(object sender, EventArgs e)
{
axGeoUrban3DWeb1 = new AxGeoUrban3DWeb();
axGeoUrban3DWeb1.LoadScene("D:\\3D\\三维数据模型\\浦口模型最新最小.gvp");
}
protected void Button1_Click(object sender, EventArgs e)
{
axGeoUrban3DWeb1.OnCtrlCommand(2);
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows;
using AxGeoUrban3DWebLib;
public partial class _3D : System.Web.UI.Page
{
public AxGeoUrban3DWebLib.AxGeoUrban3DWeb axGeoUrban3DWeb1;
protected void Page_Load(object sender, EventArgs e)
{
axGeoUrban3DWeb1 = new AxGeoUrban3DWeb();
axGeoUrban3DWeb1.LoadScene("D:\\3D\\三维数据模型\\浦口模型最新最小.gvp");
}
protected void Button1_Click(object sender, EventArgs e)
{
axGeoUrban3DWeb1.OnCtrlCommand(2);
}
}
作者: ts_chen 发布时间: 2008-12-27
这是因为你页面上灭有加载该控件引起的,加下面代码,也许能解决!
this.axGeoUrban3DWeb1.BeginInit();
this.Controls.Add(this. axGeoUrban3DWeb1);
this. axGeoUrban3DWeb1.EndInit();
this.axGeoUrban3DWeb1.BeginInit();
this.Controls.Add(this. axGeoUrban3DWeb1);
this. axGeoUrban3DWeb1.EndInit();
作者: zhbray 发布时间: 2009-06-03
我也遇到了类似的问题啊!
作者: haifeng_4216 发布时间: 2009-06-10
引发类型为“System.Windows.Forms.AxHost+InvalidActiveXStateException”的异常 解决
出现这类异常,多是引用第三方控件引起的。
在NEW时,需要初始化该对象。
AxESACTIVEXLib.AxESActiveX ax = new AxESACTIVEXLib.AxESActiveX();
((System.ComponentModel.ISupportInitialize)(this.ax)).BeginInit();
this.Controls.Add(ax);
((System.ComponentModel.ISupportInitialize)(this.ax)).EndInit();
这样就OK了。
出现这类异常,多是引用第三方控件引起的。
在NEW时,需要初始化该对象。
AxESACTIVEXLib.AxESActiveX ax = new AxESACTIVEXLib.AxESActiveX();
((System.ComponentModel.ISupportInitialize)(this.ax)).BeginInit();
this.Controls.Add(ax);
((System.ComponentModel.ISupportInitialize)(this.ax)).EndInit();
这样就OK了。
作者: chenxiaocong1212 发布时间: 2010-03-10
web页面中,this.Controls.Add(ax)中ax须为Control类型,编译就通不过啊
作者: nj04w 发布时间: 2010-06-21
谢谢“chenxiaocong1212”
作者: ztntm 发布时间: 2011-09-05
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28