如何在CShaprt中使用GetObject [英] How to use GetObject in CShaprt

查看:109
本文介绍了如何在CShaprt中使用GetObject的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以使用GetObject加载COM表单文件的实例,例如:

将CADObject作为对象调暗

CADObject = GetObject(" C:\\ \\ CAD\SCHEMA.CAD")

我们如何在CSharp中实现上述两个语句?

解决方案

您好广告,


对象CADObject;

CADObject = GetObject(" C:\ CAD\SCHEMA.CAD");


我不确定GetObject的C#版本是什么,但你可以使用

Visual Basic版本。

你将需要添加Microsoft.VisualBasic命名空间以及对VisualBasic程序集的引用(Microsoft.VisualBasic.dll I

怀疑)。


-

快乐编码!

Morten Wennevik [C#MVP]


使用:

对象CADObject = Marshal.BindToMoniker(" C:\\\\\\SCHEMA.CAD");


但是,为什么不呢令状这在vb.net中更适合COM互操作

使用后期绑定对象。


Willy。

"广告" < ad@wfes.tcc.edu.tw>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP15.phx.gbl ...

我们可以使用GetObject加载COM表单文件的实例,如:

将CADObject变为对象
CADObject = GetObject(" C:\ CAD\SCHEMA.CAD")

我们如何在CSharp中实现上面的两个语句?



我使用了Microsoft.VisualBasic命名空间以及参考对于microsoft.visualbasic.dll来说,它是b $ b,但是在编译时仍然会出现

错误消息:

GetObject不存在在类的命名空间中..

我的代码如下:


对象域;

domain = GetObject(" WinNT :// Workgroup / MyComputerName");


" Morten Wennevik" < Mo ************ @ hotmail.com>

???????:opshtfjifkklbvpo @ pbn_computer ...

嗨广告,

对象CADObject;
CADObject = GetObject(" C:\ CAD\SCHEMA.CAD");

我不是确定GetObject的C#版本是什么,但是你可以使用
Visual Basic。
你需要添加Microsoft.VisualBasic命名空间以及对VisualBasic程序集的引用( Microsoft.VisualBasic.dll我怀疑)。

-
快乐的编码!
Morten Wennevik [C#MVP]



We can use GetObject to load the instance of COM form file like:

Dim CADObject As Object
CADObject = GetObject("C:\CAD\SCHEMA.CAD")

How can we implement the two statements above in CSharp?

解决方案

Hi ad,

object CADObject;
CADObject = GetObject("C:\CAD\SCHEMA.CAD");

I''m not sure what the C# version of GetObject is, but you can use the
Visual Basic one.
You will need to add the Microsoft.VisualBasic namespace as well as a
reference to the VisualBasic assembly (Microsoft.VisualBasic.dll I
suspect).

--
Happy Coding!
Morten Wennevik [C# MVP]


Use :
object CADObject = Marshal.BindToMoniker("C:\\CAD\\SCHEMA.CAD");

but, why not write this in vb.net which much better suited for COM interop
using late bound objects.

Willy.
"ad" <ad@wfes.tcc.edu.tw> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...

We can use GetObject to load the instance of COM form file like:

Dim CADObject As Object
CADObject = GetObject("C:\CAD\SCHEMA.CAD")

How can we implement the two statements above in CSharp?



I have using Microsoft.VisualBasic namespace as well as a reference to
the microsoft.visualbasic.dll, but it still faill in compile time with the
error message:
GetObject doesn''t exist in the namespace of class..
My code is below:

object domain;
domain = GetObject("WinNT://Workgroup/MyComputerName");

"Morten Wennevik" <Mo************@hotmail.com>
???????:opshtfjifkklbvpo@pbn_computer...

Hi ad,

object CADObject;
CADObject = GetObject("C:\CAD\SCHEMA.CAD");

I''m not sure what the C# version of GetObject is, but you can use the
Visual Basic one.
You will need to add the Microsoft.VisualBasic namespace as well as a
reference to the VisualBasic assembly (Microsoft.VisualBasic.dll I
suspect).

--
Happy Coding!
Morten Wennevik [C# MVP]



这篇关于如何在CShaprt中使用GetObject的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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