2

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

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

  • 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

  • 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

Where I am making mistake, and which is the easiest way to use vb.net from vbscript!

Many thanks!

3
  • 2
    See stackoverflow.com/questions/769332/… Commented Feb 1, 2010 at 11:15
  • When i try this regasm /codebase myDLL.dll i am getting The message: "The /codebase switch is intended to be used only with signed assemblies. Please give your assembly a strong name and re-register it. RegAsm : warning RA0000 : No types were registered" Commented Feb 1, 2010 at 11:25
  • 1
    Check out geeksengine.com/article/create-dll.html. In particular the step 2. Configure project properties to make it COM visible. Commented Feb 7, 2012 at 1:02

1 Answer 1

0

You are on the correct path. Does your class have a default contructor? Does your class have a public method?

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.

Sign up to request clarification or add additional context in comments.

1 Comment

In your project properties, in the Compile section, you should check the "Register for COM interop" box.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.