...在命名空间"Microsoft.Office.Interop.Excel"中含糊不清 [英] ... is ambiguous in the namespace 'Microsoft.Office.Interop.Excel'

查看:111
本文介绍了...在命名空间"Microsoft.Office.Interop.Excel"中含糊不清的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我正在vb.net 2008下构建一个运行正常的应用程序.
现在,我试图将其迁移到vb.net 2010中,但仍然收到与命名空间Microsoft.Office.Interop.Excel中不同模棱两可有关的错误.这是指数据表,工作簿,工作表,应用程序.

在网上对该错误进行少量研究后,似乎是在vb.net 2008中,而不是由于迁移所致.

有谁知道为什么会这样.

非常感谢,
Mikcutu.

hello,

I was building an application under vb.net 2008 which worked OK.
Now, I was trying to migrate it into vb.net 2010 and I still receive errors relate to different ambiguous in namespace Microsoft.Office.Interop.Excel. This is refering to DataTable, Workbook, Worksheet, Application.

After few researches o the net about this error, it seems to be in vb.net 2008 and not due to migration.

Does anyone have any idea why it is happening.

Thanks a lot,
Mikcutu.

推荐答案

好吧,从您的Sergey解决方案开始,我一直在仔细阅读这些参考文献,发现很少有其他有关Office的参考文献(不同版本) .

我只是删除了所有这些文件,然后添加了正确的文件(Microsoft.Office.Interop.Excel),它通过了此错误.

...只是希望这将对我和以后的初学者有所帮助,并感谢所有花了一些时间来探讨我的问题的人.
well, starting from your Sergey''s solution, I was looking closely to the references and saw there are few other references to Office (different versions).

I just removed all of them and added the right one (Microsoft.Office.Interop.Excel) and it passed over this error.

...just hope this will help the future beginners as me and thank you all who spent some time to get a look on my question.


不,您所引用的内容是否正确并不含糊集会.例如,对于Visual Studio,您需要使用添加引用"窗口的".NET"选项卡来引用程序集.当您执行此操作时,您将引用添加到特定Office版本的互操作"程序集.您将在此窗口的列表中看到引用.

—SA
No, it is not ambiguous is you reference proper assembly. With Visual Studio, for example, you need to reference an assembly using the ".NET" tab of the "Add Reference" window. When you do it, you add the reference to the "interop" assembly for a specific Office version. You will see the reference in the list in this window.

—SA


您的问题不清楚.
但请看这里,这可能对您有帮助.
我也遇到过类似的情况.
就我而言,错误是
之间的含糊不清的引用 System.Windows.Forms.Label和
ZedGraph.Label"
实际上这两个名称空间都具有相同的类名称Label
当我创建Label的变量时,系统会混淆Label的含义,它是ZedGraph还是System.Windows.Forms.
我以此解决了这个问题.

Your Question is not clear.
but take a look here it may help full for you.
I had also face situation similar to this.
In my case "the error is an ambiguous reference between
System.Windows.Forms.Label and
ZedGraph.Label"
actually both of these name spaces having same class name Label
when i create a variable of Label then system confuses what is meant by Label is it form ZedGraph or System.Windows.Forms.
i solve this problem by this.

using System.Windows.Forms;
using ZedGraph;
using zedLabel = ZedGraph.Label;
using Label = System.Windows.Forms.Label;  // here i am explicitly telling what i mean of Label so the System do not confuse with Other Object having same name in other namespace


当我想创建ZedGraph.Label类型的对象时,我使用


when i want to create a object of type ZedGraph.Label then i use

ZedGraphLabel  Objec = new ZedGraphLabel()


如果我创建这样的对象.


if i create an object like this.

 // it creates a label of type System.Windows.Forms.Label;
Label l = new Label();


另一种方法是使用完整参考.像这样


and an other way is this use complete reference . like this

Zedgraph.Label objLabel = new Zedgraph.Label();
System.Windows.Forms.Label objLabel2 = new System.Windows.Forms.Label();



希望您能理解..



I hope you understand..


这篇关于...在命名空间"Microsoft.Office.Interop.Excel"中含糊不清的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆