vc++ to vb.net

iijb

Member
Joined
Mar 16, 2006
Messages
6
Programming Experience
Beginner
Hi,
Can we use a dll created in vc++ in a vb.net application.

Thanks & Regards
iijb
 
Hi,
Thanks and pardon me for wrong place posting bcoz im a newbie in this forum.
Then plz give me steps for doing vc++ to vb.net.
Regards
iijb
 
What do you mean? converting VC++ DLL to vb.net. Or using a VC++ DLL in a vb.net app?

If it's the latter then its as simple as adding a reference to it in your application.
 
Hi,
Yes using a VC++ DLL in a vb.net app, and I cant see the dll in the reference list.
Thanks&Regards,
iijb
 
in the solution explorer right click on the project and select "Add Reference" then click "Browse" and locate the dll file

also be sure to distribute this dll with the application (a copy of the dll will be in the bin folder with your exe and any other dll's)
 
Is the DLL a managed or unmanaged piece of code? You can't access an unmanaged DLL by referencing it. (Unless it is a COM DLL). Instead you need to use the DECLARE keyword in your code to define the entry points you wish to use. Once the entry point is defined using DECLARE, you can just call the function/sub directly in your code. For example:

VB.NET:
[SIZE=2]
[/SIZE][SIZE=2][COLOR=#0000ff]Private [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Declare [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Function[/COLOR][/SIZE][SIZE=2] CP210xRT_ReadLatch [/SIZE][SIZE=2][COLOR=#0000ff]Lib[/COLOR][/SIZE][SIZE=2] "CP210xRuntime.dll" ([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] Handle [/SIZE][SIZE=2][COLOR=#0000ff]As [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Integer[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByRef[/COLOR][/SIZE][SIZE=2] Latch [/SIZE][SIZE=2][COLOR=#0000ff]As [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Byte[/COLOR][/SIZE][SIZE=2]) [/SIZE][SIZE=2][COLOR=#0000ff]As [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Integer
[/COLOR][/SIZE]

You must also still include the DLL with your application and install it into the application path as well.
 
Back
Top