Instantiate dll created in C # .net for VB6

2

I have a dll that I want to consume, developed in C #, and I want to load this dLL in VB6. How can I do this? What steps should I follow?

Inside the VB6 code below you already have a call to this dll:

Dim mail As New MamMail
    Body = Replace(Body, vbCrLf, "</BR>")
    mail.SendMail smtpServer, smtpPort, smtpSsl, userName, Password, fromAddress, toAddress, cc, Subject, Body
    Set mail = Nothing
    Exit Sub

But when compiling no vb6 I get: compile error.User defined type not defined .

    
asked by anonymous 15.05.2015 / 18:57

2 answers

0

In your DLL project do the following:

Configuration Properties - > Build set the Register for COM interop property to the value True .

And in your project VB add the reference to Type Library "DLLName";

Source.

    
15.05.2015 / 20:02
0

VB6 calling .Net components is not recommended. Remember that VB6 support no longer exists. But if you need to, you should export your interface with the commands themselves for this. See this link for more information. Home Remember to set your dll to x86, otherwise you might experience error loading the module in 64 bit environment.

    
15.05.2015 / 20:12