在VBScript中使用vb.net [英] Use vb.net in VBScript

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

问题描述

如何从VBScript调用vb.net中的函数?

How to call a function in vb.net DLL from VBScript?

我做了以下操作:
- 在vb中创建一个名为Class1的公共类。 net。

I did the following: - I create public class named Class1 in vb.net.


  • 我去Visual Studio 2008命令提示符并转到我的类dll - C:\Myapp \bin \Debug并键入以下命令tlbexp myDLL.dll之后,我得到消息组装导出到
    C:\Myapp\bin\Debug\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:warning 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

我在做错误,这是从vbscript使用vb.net最简单的方法!

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.

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

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