Making vb.NET dll callable in VBscript

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Could anyone point me to where there is more information available on calling
a vb.net dll from a vbscript? I have found some links, but most are pretty
unclear as to what is needed.
 
On your .NET side:

- Create a ClassLibrary with this code:

Public Interface MyInterface
Function Sum(ByVal i1 As Integer, ByVal i2 As Integer) As Integer
End Interface

Public Class Class1
Implements MyInterface

Public Function Sum(ByVal i1 As Integer, ByVal i2 As Integer) As Integer
Implements MyInterface.Sum
Return i1 + i2
End Function

End Class

- Register the class library for COM Interop (Project Properties window,
Build node)

On your VBScript side:

Dim objClass1 As Object

Set objClass1 = CreateObject("ClassLibrary2.Class1")

MsgBox objClass1.Sum(1, 1)

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top