中易网

System.Runtime.InteropServices.COMException(0x80040202)

答案:2  悬赏:0  
解决时间 2021-03-04 00:08
有关调用实时(JIT)调试而不是此对话框的详细信息,
请参见此消息的结尾。

************** 异常文本 **************
System.Runtime.InteropServices.COMException (0x80040202): The index passed was not within the valid range.
在 ESRI.ArcGIS.Geodatabase.IFeature.get_Value(Int32 Index)
在 ArcObjectsOpenFile.MainForm.douglasThresholdToolStripMenuItem_Click(Object sender, EventArgs e) 位置 E:\代码ArcGIS10-06.05\ArcObjectsOpenFile\MainForm.cs:行号 886
在 System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
在 System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
在 System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
在 System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
在 System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
在 System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
在 System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
在 System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)
在 System.Windows.Forms.ToolStrip.WndProc(Message& m)
在 System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
最佳答案
典型的运行时错误。出错的根本就是IEnumable/ISerializable类型对象的下标溢出,假设:一个List对象有4条记录,下标只能是 [0],[1],[2],[3] ,其它都会出错。
全部回答
<br><br>那我翻译一下给你看<br><br>[<b>system.runtime.interopservices.comexception</b>] -2147352559 (80020011) does not support a collection.<br>the above code produces this error when compiled on an excel 2003 machine and run on excel 2000&nbsp;&nbsp;<br>错误:不支持集合<br>发生的情况是在2003下编译的然后去低版本的装了2000的机子运行<br><br>solution<br>解决方法<br>you will find three distinct methods suggested to work around these problems:&nbsp;&nbsp;<br>他说发现了3种方法<br>build your project on different machines for compatibility with each respective version of office.&nbsp;&nbsp;<br>第一种是在装有不同版本office的机子上都去重新编译下程序。<br>install different versions of office on your build machine (how-to).&nbsp;&nbsp;<br>第二种是是在你开发的自己上编译出不同版本office的程序(他给了你个链接告诉你怎么去做)。<br>use "late binding" to call whatever version of office is available at run-time&nbsp;&nbsp;<br>第三种是用“滞后生成”去相应不同版本的office(我也不知道他说的是什么方法)<br>here, i suggest a fourth method: build to the lowest common denominator.<br>这里,他要推荐第四种方法:编译生成最大兼容性的程序,应该就死带常用方法的版本,不带各版本带的各自的特殊方法(大概这个意思。。。)。<br><br>step-by-step<br>一步步来。。。<br><br>1.locate the excel 9 (2000) type library&nbsp;&nbsp;<br>先找到excel 9(2000)的类型库<br>normally, type libraries are named *.tlb&nbsp;&nbsp;<br>通常,类型库是以tlb为后缀名<br>after a little googling, however, i found that the excel 9 type library is called excel9.olb&nbsp;&nbsp;<br>但在一点google后。。。。我发现了excel 9的类型库名字叫excel9.olb&nbsp;&nbsp;<br>i quickly found the excel.olb file on my (fully licensed and registered!!!) office 2000 installation cd.&nbsp;&nbsp;<br>我很快地发现了excel.olb文件在我的(完全授权和注册过了的,意思就是正版!!!)office 2000安装光盘里。<br><br>2.copy the excel 9 type library to the build machine&nbsp;&nbsp;<br>从光盘拷贝这个文件到你开发的机器的硬盘里<br>3.create an interop assembly from the excel9 type library&nbsp;&nbsp;<br>为这个excel 9类型库文件创建一个托管程序(也就是*.interop.dll)<br>choose a unique name that will distinguish your interop dll from others that may be found&nbsp;&nbsp;<br>选择一个唯一的名字去命名将要创建出来的*.interop.dll,<br>use the .net sdk tool called tlbimp.exe to build your interop assembly from the command line&nbsp;&nbsp;<br>用vs bin目录下自带的tlbimp.exe生成类型库的托管程序<br>他这里写了一个批处理文件,你照着他给的例子改,my.excel9.interop.dll就是上面说的那个你要命名的创建出来的托管程序的文件名,可以改掉<br><br>@echo off<br>&nbsp;set prog="c:\program files\microsoft visual studio .net 2003\sdk\v1.1\bin\tlbimp.exe"<br>&nbsp;%prog% excel9.olb /out=my.excel9.interop.dll<br>&nbsp;pause<br><br>4.link this new interop assembly to the vs.net project, and build&nbsp;&nbsp;<br>把生成的这个托管文件(my.excel9.interop.dll)连接进你的这个vs 工程里,而且编译生成。<br>他估计用的是vs2003,vs2005里不能在工程的添加引用里去浏览加入com,你要在工具箱里翻到com页,然后去找到刚生成的my.excel9.interop.dll<br>加进来,然后引用。<br><br>5.update code to reference the new interop library<br>更改你的2003编译的程序里有关调用excel区间(range)之类的一些写法为2000的写法(2003和2000参数个数和顺序可能不太一样)<br>这里老外说了。 <a href="http://wenwen.soso.com/z/urlalertpage.e?sp=shttp%3a%2f%2fdevcity.net%2fprintarticle.aspx%3farticleid%3d163" target="_blank">http://devcity.net/printarticle.aspx?articleid=163</a>看不懂就翻译下。我也一起学习了。不行就重装下软件。<br>6.deploy this interop assembly in the \bin directory along with the project&nbsp;&nbsp;<br>your project will now work on any machine with office 2000 or higher&nbsp;&nbsp;<br><br>编译并发布,别忘了带上这个my.excel9.interop.dll一起发布<br>现在你的程序能在装有office2000或更高版本的机子上运行了。
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
石家庄铁路职业技术学院面积多大?图书馆规模
在异地工作交的五险一金可以转回到原户口地么
诸暨农商银行新世纪分理处地址在哪,我要去那
汉马车行在哪里啊,我有事要去这个地方
用什么指标来分析白银短期行情?
安庆包子铺怎么去啊,有知道地址的么
主机来电自动开机怎么办
天保堂平价大药房车公庄店地址在哪,我要去那
怎么成为特检院在编人员?
美国加州牛肉面大王科普公园店地址有知道的么
山东省济宁市由阜市到讧苏省淮安市淮安区有多
便民大小窗帘店这个地址在什么地方,我要处理
露天田里种值药材
帮我翻译一首歌《Jenny Don’t Be Hasty(珍
吴县市渭塘李浜塑料制品厂怎么去啊,有知道地
推荐资讯
男生戴黑框眼镜搭配什么发型好看!
小编详解:律信智投可靠吗
儿子2012年12月04日凌晨02;45分出生阴历10月
用什么词语形容机会多,不急于一时
小学数学中的奇数的奇,读“qi”还是“ji”?
落地式脚手架与悬挑式脚手架可以混用么?有何
TRX的训练架哪里有的卖
428针的细毛线恒源的上下针织好了,平针织正
独立显卡512m和tc512m有什么实质性的区别,详
机械设计制造及其自动化专业的填报那些专业的
西里超市NO.003在哪里啊,我有事要去这个地方
童之梦幼儿园我想知道这个在什么地方
手机登qq时,显示手机磁盘不足,清理后重新登
刺客的套装怎么选啊?