I have created a DLL files using C#....

How can i use it in Visual Basic 6.0?

Please help me with this project...can you give me codes for it or step by step procedure

THANK YOU!!!!!!!!!!!!

8 Years
Discussion Span
Last Post by hkdani

you need to register that DLL with windows using the REGSVR32 key and then refer that ddll from Project------> Reference menu of VB IDE.

Next you need to create objects of the class and call its objects.


Thanks for reply debasisdas,...How's that? how can I register my DLL using REGSVR32?

Anyweiz here's the DLL i make from C#:

using System;
using System.Collections.Generic;
using System.Text;

namespace MyDLL
    public class Class1
        public int addnumbers(int a, int b)
            return a + b;

I just need to call and use it in Visual Basic wherein I can Add numbers when I click a button!....

Edited by Dani: Formatting fixed


I've found it easyest to copy the dll to the system32 folder then run the below

get a command prompt (start run cmd)

type in
regsvr32 dllname


its not to download from any where. REGSVR32 file is locataed at your windows drive (like c:\windows\system32\REGSVR32.exe) just you have to double click on dll file or right click and open with then select file from c:\windows\system32\REGSVR32.exe
after confirmation, your file is registered now.
and then refer that dll from Project------> Reference menu of VB IDE.
Next you need to create objects of the class and call its objects.



when i register the dll file using 'project --> references', i got this error message
"Can't add a reference to the specified file."
what's wrong?


Good grief. You're using a C# .NET DLL and trying to place it in VB6?

Maybe you're really trying to place a C or C++ .NET DLL and place it a Visual Basic 6 project? In which case, you're in the wrong forum. Go to the Visual Basic .NET forum.

I don't believe a C++ .NET DLL is compatible with VB6. I've tried this before and have had the same result as you posted: "Can't add a reference to the specified file."

You can create a DLL using the C or C++ programming language to use in VB6. But you have to follow the guidelines for working with VB6. I don't even know that you can create a C# DLL.

Edited by hkdani: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.