Creating an object from a DLL

G

Geoff Jones

Hi

I have a DLL which was created using MFC (and set to Automation). In this
DLL there a class called MyTestClass. My question is, how do I create an
object of this class from within a vb.net application?

Thanks in advance

Geoff
 
Q

Q

Hello Geoff,

you first have to add your DLL-file to the references of your project.

Then add code to your application as shown below.
In the example the DLL-file is called MyDLL. In this DLL-file there is a class named MyTestClass and in this class there is
a function named MultiplyThis which returns a result.

Example:

Imports [MyDLL]

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyProcedures As New MyTestClass
Dim Result As Integer
Result = MyProcedures.MultiplyThis(2, 5)
End Sub

Hope this helps!

Regards,

Q
 
G

Guest

I seem to remember reading in one of the notes on this newsgroup that DLL's
created with MFC couldn't be used with .Net applications. I could be wrong
but if your DLL doesn't work, you might want to look at this possibility.
 

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

Top