Making vb.NET dll callable in VBscript

Making vb.NET dll callable in VBscript

Post by RyBMZWlmaG » Fri, 18 Mar 2005 05:41:07


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.
 
 
 

Making vb.NET dll callable in VBscript

Post by Carlos J. » Fri, 18 Mar 2005 19:52:56

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.yqcomputer.com/


"G Leifheit" < XXXX@XXXXX.COM > escribien el mensaje
>> 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.