如何从VBScript调用vb.net DLL中的函数?
How to call a function in vb.net DLL from VBScript?
我做了以下内容: - 创建一个名为Class1在vb.net公共类
I did the following: - I create public class named Class1 in vb.net.
我去到Visual Studio 2008命令提示符,然后转到我的课的dll - C:\ MYAPP \斌\调试,然后键入以下命令tlbexp MYDLL.DLL后,我得到的消息,大会远销 C:\ MYAPP \斌\调试\ myDLL.tlb
I go to Visual Studio 2008 Command Prompt and go to my class dll - C:\Myapp\bin\Debug and type following command tlbexp myDLL.dll after that i get message Assembly exported to C:\Myapp\bin\Debug\myDLL.tlb
我键入以下命令regasm MYDLL.DLL在此之后,我得到以下信息 RegAsm:警告RA0000:无类型登记
After this I type following command regasm myDLL.dll and i get following message RegAsm : warning RA0000 : No types were registered
这是我的阶级是这样的:
This is how my class look like:
Public Class Class1
Public Function ADD(ByVal first As Integer, ByVal sec As Integer)
Dim abc As Integer
abc = first + sec
Return abc
End Function
Public Function Subtraction(ByVal first As Integer, ByVal sec As Integer)
Dim abc As Integer
abc = first - sec
Return abc
End Function
end class
我在哪里犯错,并且是用vb.net从VBScript最简单的方法!
Where I am making mistake, and which is the easiest way to use vb.net from vbscript!
非常感谢!
您在正确的道路。请问你的类有一个默认的构造器?请问你的类有一个公共的方法?
You are on the correct path. Does your class have a default contructor? Does your class have a public method?
此外,用鼠标右键单击在Visual Studio项目。我相信这是一个注册COM或使COM可见复选框,为您节省了几步。
Also, right click on your project in Visual Studio. I believe there is a "register for COM" or "make COM visible" checkbox to save you a few steps.