How to use C function in VB?

bergie

Member
Joined
Jun 22, 2004
Messages
12
Programming Experience
3-5
i want to use some functions written by C language in VB.net 2003 . how can i use them . thank you .
 
Joined
Jun 10, 2004
Messages
6
Programming Experience
Beginner
I'm new at this too but I just managed to call a C# function from my vb.net program so maybe this'll help.

I'm assuming the functions have already been compiled to a DLL. Open your VB.net project. Go to Solution Explorer. Right-click on References and then click on Add Reference. Click Browse and navigate to your DLL. Select it, click Open and then Click OK. There should now be a reference to your DLL in the References section of Solution Explorer. If you click on it and look at its properties, you'll see a Copy Local property which makes sure it ends up in the \bin folder and, presumably, the application folder if you build a setup for it.

If you right-click on your DLL in Solution Explorer, one of the options will be "View in Object Browser". This will enable you to see what the DLL exposes to the outside world.

You can then instantiate any classes in the normal way but bear in mind that you'll either need to import the namespace or use the fully-qualified class name to do so.
 
Top Bottom