Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

NI4882.dll error

While running a VB8.0 project in debug mode I receive a NI4882 error as follow: A first chance exception of type 'Systme.Invalid Operation Exception' occurred in National Instruments NI.4882.dll. The program works fine on my laptop, however when copy it over to my desktop I now get this error. The .dll reference listing in my project resource is: C:\Program Files\National Instruments\MeasurementStudioVS2005\DotNet\Assemblies\Current\NationalInstruments.NI4882.dll.

The program was developed under Visual Basic 2008 Express Edition.

 

Thank you

0 Kudos
Message 1 of 18
(14,344 Views)

Hello NuggetSMD,

 

I was wondering if you installed the NI-488.2 driver on your desktop. If you haven't I would recommend installing this driver and then trying to run your project. If this doesn't work I was wondering if you could give us the error code that you get when you run the program. Have a great day!

 

Best Regards,

 

Adam G 

National Instruments
Applications Engineer
0 Kudos
Message 2 of 18
(14,329 Views)

Adam,

I don't remember the error code # other than it started with an 8. I am at home right now responding. I do have some other information for you. I did install the updated drivers for NI4882 version 2.7 (I had version 2.5). The problem I am seeing is the NI4882.dll is not assembling into the bin file when I build my solution. Without that there is no way my program will work correctly.

I did go to the resouce section in my project and added the NI.Common and NI4882.dll . This still did not work.

Briefly let me explain my steps and my objectives.

My desktop has the VS2005 Basic, C, and C++ applications. I installed VS2008 Basic, C, and C++ onto my desktop. I did this because that is what I was using to develop my program on my laptop.

I took my project folder from my laptop which has all the files to run the program and copied it over to my desktop. I then deleted the bin and obj file folders only. Next I verified in my resource that I had the paths for the updated drivers.

I did a Build Solution which created new bin and obj folders of which neither one contained any NI4882.dll files.

If I can get the right process to properly remove all the files once I copied the folder over to my desktop and the correct way to Build the new program on my desktop that will include the NI4882.dll files in the bin folder, I believe the problem will be solved.

The program works great on my laptop.

Hopefully you can give me some insight as to the right process steps for transferring a program off my laptop to my desktop.

Just an FYI

A program that was developed on the desktop under VS2005 Basic, C, and C++ compiled and ran just fine last week.

 

Thanks for the help.

Steven

 

0 Kudos
Message 3 of 18
(14,323 Views)

Hello NuggetSMD,

 

I have a couple of ideas you can try. First is to try and run the built in examples that come with Measurement Studio. I would like you to try a VISA one since it should use the NI 488.2 driver. They can be found at 

C:\Documents and Settings\All Users\Documents\National Instruments\NI-VISA\Examples\DotNET3.5. If these work I was wondering if you could try and create a new project on your desktop PC and just copy in your source files to the new project. Also if you could a chance I was wondering if we could get the full error code you are receiving. Have a great day!
Best Regards,
Adam G 

 

National Instruments
Applications Engineer
0 Kudos
Message 4 of 18
(14,311 Views)

Adam,

Ok I did try to copy the source code only for one device and its setup code into a new project on the desktop. When I started debugging I received a write error which is the error code that comes up under the "Catch" part of the code within the "Try".

I did not find a VISA folder in the path that you gave me, however I did find in that path a vb folder with a simple read/write routine. I ran that and it came up with the same write error.

One thing is puzzeling. I can run the GPIB analizer found in the NI Measurment program ok. It will scan my devices on the GPIB connection and then I can select a device and communicate with it directly with no problem.

So there is something definitely wrong using Visual Studio Basic that is not linking correctly.

Do you think it would be worthwhile to reload Visual Studio Express 8.0? Since updating from VS 5.0 which worked, VS 8.0 doesn't work. I feel fairly confident that updating the NI4882 drivers from 2.5 to 2.7 was ok since the NI Measurement program still works ok.

Looking for the right proceedure to start from scratch and load everthing in the correct order.

Visual Studio Express 8.0 Basic, C, & C++; NI updated drivers 2.7 (I think this is just fine); Measurement Studio 5.0 professional.

 

Thanks,

Steven

0 Kudos
Message 5 of 18
(14,253 Views)

Hello NuggetSMD,

 

I was wondering if you have the error code you get when you try to run your program? Another suggestion is to make sure .NET support is installed for the NI-488.2 driver. You can check this my modifying the install for the 488.2 driver and making sure support for .NET is being installed. Have a great day!

 

Best Regards,

 

Adam G 

National Instruments
Applications Engineer
0 Kudos
Message 6 of 18
(14,233 Views)

Adam,

I am not receiving any error codes now. The only way I know it is not working is the Catch All error pops up saying " Write Error to GPIB" or something like that.

 

I will check if the .Net is installed. I do recall seeing .Net but not sure.

I got mixed up on my terminology in my last email.

 

The application Measurement and Instrumentation allows me to check my GPIB connection. It will scan the GPIB controller and report back all the instruments connected. I can select and instrument and communicate with it directly. This all works just fine.

I can send and receive commands using this application.

 

When I run the example in VS Basic 8.0 (Simple Read/Write program) it acts the same way my program does" Write error to GPIB".

 

Here is a snippet of the code:

Private Sub GPIB195Setup()

         Try

              GPIB195Voltmeter.Write(ReplaceCommonEscapeSequences("F0"))

         Catch ex As Exception

              MessageBox.Show("195 write error " + ex.Message)

          End Try

End Sub

 

0 Kudos
Message 7 of 18
(14,230 Views)

Adam,

I reloaded VS8.0 Express and NI488.2. When I try to add ,NET resources to my project, I do not see National Instruments to add.  I can see the files in WINDOWS\assembly\GAC_32 or GAC_MSIL. Why am I not able to see the files to add?

What specific procedure do I use to get these files installed. Please give specific details.

 

Thank you,

Steven

0 Kudos
Message 8 of 18
(14,217 Views)

Hello Steven,

 

I installed VS 2008 Express on a Windows XP machine and was able to add the references and run an example program. These are the steps that I went through:

 

1. Installed VS 2008 Express

2. Installed NI 488.2 driver and added support for the 3.5 .NET framework

3. Added references for National Instruments by going to Project»Add Reference and scrolling down to National Instruments 488.2

4. The Example I used is located at C:\Documents and Settings\All Users\Documents\National Instruments\NI-488.2\Examples\DotNET3.5\SimpleReadWrite\vb

 

I was wondering if these steps are different from what you did? And if so how? Have a great day!

 

Best Regards,

 

Adam G 

 

National Instruments
Applications Engineer
0 Kudos
Message 9 of 18
(14,185 Views)

Adam,

I did most of those steps.

1. Installed VS Express 8.0

2. Installed 488.2 driver (downloaded and ran the wizard. It told me what would be installed and what was already there)

The application said the 3.5 .Net framework had a red X.

3. Went to the project to add reference and scrolled down looking for NI. After Microsoft it went to the P's. There was no NI.???

4. Could go no futher.

 

I may be pulling the 488.2 from the wrong location. What link did you use to download the 488.2 driver and specifically how did you tell it to add the 3.5 .Net framework? Maybe with these instructions I might have left out a step.

 

This is very frustrating since I thought I was doing everything correctly.

 

Thank you,

Steven

 

0 Kudos
Message 10 of 18
(14,181 Views)