VB.NET .DLL Import Problems

Post general discussions on using our drivers to write your own software here
Post Reply
stockholm_syndrome

VB.NET .DLL Import Problems

Post by stockholm_syndrome »

I am using the 32-bit .dll for a 212 and VB.NET. When I try to add a reference to adc20032.dll in my project the following error occurs:

A reference to 'C:/Program Files/Pico/DRIVERS/win32/adc20032.dll' could not be added. This is not a valid assembly or COM component. Only assemblies with extension 'dll' and COM components can be referenced. Please make sure that the file is accessible, and that it is a valid assembly or COM component.

Anyone else with the same problem, or an answer!?!?!?!

Thanks in advance.

Sarah

Post by Sarah »

Hi

Thank you for your post.

If you look at MSDN this will give you information on including dll files in VB.net.

Hope this helps

Best Regards

Guest

Post by Guest »

Hi ,
I too faced same problem .
Can anyone give the solution.
Thanks in advance.

Prasanna

dundas
User
User
Posts: 4
Joined: Wed Aug 24, 2005 2:12 am

Post by dundas »

Sarah wrote:Hi

Thank you for your post.

If you look at MSDN this will give you information on including dll files in VB.net.

Hope this helps

Best Regards
Hi Sarah, I am also facing this same issue while I try to reference the win32\adc1132.dll in Visual Basic.Net 2002.

Q1:
The problem is this dll can't be referenced if we "add reference", please instruct us for the correct way or just tell us the name of the way to do it.

Q2:
Is this dll really a 32-bit dll?if not, I guess we have to
http://support.microsoft.com/kb/105761/EN-US/


Any advices are greatly appreciated.

dundas
User
User
Posts: 4
Joined: Wed Aug 24, 2005 2:12 am

Post by dundas »

ok, I think u simply CANT add that dll as reference. I solved the problem by simply putting that dll into /bin directory of my VB project and add a module wiz

Code: Select all

Module adc1132

    Declare Function adc11_get_driver_version Lib "ADC1132.dll" () As Integer
    Declare Function adc11_open_unit Lib "ADC1132.dll" (ByVal port As Integer, ByVal product As Integer) As Integer
    Declare Function adc11_set_unit Lib "ADC1132.dll" (ByVal port As Integer) As Integer
    Declare Sub adc11_close_unit Lib "ADC1132.dll" (ByVal port As Integer)
    Declare Function adc11_get_unit_info Lib "ADC1132.dll" (ByVal S As String, ByVal lth As Integer, ByVal line_no As Integer, ByVal port As Integer) As Integer
    Declare Sub adc11_set_do Lib "ADC1132.dll" (ByVal state As Integer)
    Declare Function adc11_get_value Lib "ADC1132.dll" (ByVal channel As Integer) As Integer
    Declare Function adc11_set_trigger Lib "ADC1132.dll" (ByVal enabled As Integer, ByVal enable_auto As Integer, ByVal auto_ms As Integer, ByVal channel As Integer, ByVal dir As Integer, ByVal threshold As Integer, ByVal delay As Integer) As Integer
    Declare Function adc11_set_interval Lib "ADC1132.dll" (ByVal us_for_block As Long, ByVal ideal_no_of_samples As Long, ByVal channels As Integer, ByVal No_of_channels As Integer) As Long
    Declare Function adc11_get_values Lib "ADC1132.dll" (ByVal values As Integer, ByVal no_of_values As Long) As Long
    Declare Function adc11_get_times_and_values Lib "ADC1132.dll" (ByVal times As Long, ByVal values As Integer, ByVal no_of_values As Long) As Long

    Declare Auto Function adc11_run Lib "adc1132.dll" (ByVal no_of_values As Long, ByVal method As Short)
    Declare Auto Function adc11_ready Lib "adc1132.dll" () As Short

End Module
which included the functions in that library I need, and it works like a charm.

thx anyways.

Guest

Post by Guest »

Use Visual Studio 2005 instead. I had the same problem in VS2003, but when i changed to VS2005, the problem was gone :)

blieki

Post by blieki »

Can someone help wit this problem withough getting too complicated or having to switch to vs2005? :x :x

Guest

Post by Guest »

If you first add the .dll to your bin folder manually, you can then add the reference through Visual Studio 2003 by browsing to that file in the project's bin folder.

Guest

importin dll in vb studio 2005

Post by Guest »

hii.. i have a c++ file.. which i have to use in vb studio 2005 . i have saved that c++ file in dll format , so its dll file has been created, but when i am importing that file through reference in my vb studio project.. error is coming about invalid com or assembly..

i wanna know whether the way i am creating the dll of c++ file is correct or not..
please help me out..

Guest

Post by Guest »

Did you try building the DLL file before building your app? if your DLL hasn't been built yet VS won't usually automatically build a new one until you've built it the first time.

Guest

Post by Guest »

GET NEWER VISUAL STUDIO VERSIONS!

Guest

Re: VB.NET .DLL Import Problems

Post by Guest »

Well, same error appears in my project - I have VS2008. I have tried everything that should fix my problem, even that module and bin directory stuff. It's not working....

So, I don't think so, that newer version of VS is helpful :roll:

Jay H
Newbie
Posts: 0
Joined: Wed Mar 31, 2010 2:13 pm

Re: VB.NET .DLL Import Problems

Post by Jay H »

Um, I am interfacing with a PicoScope 5204 with a .DLL provided by PicoTech (ps5000.dll) without a problem and in Visual Studio 2008. I also have a VB6 instance of my application using Visual Studio VB6.0. Both work fine and I have it running....

I never had to do anything within the VS IDE. the .DLL isn't a "component" like say MS Visual Basic Power Packs would be for certain lines/shapes and other controls. All you need to do is copy that .DLL to %windows%\system32 Or you could modify your DECLARE statements to point to your directory that the .DLL is and it should work. At least that is how I am using it.

Maybe I'm not understanding your question, but it's working for me.

Jay

Post Reply