LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"The type 'LVBaseRefnum' is defined in assembly that is not referenced" error

Hi. I am trying to run a LabView VI from C# form application. I followed some steps from a blog to do it but I am getting the error called "The type 'LVBaseRefnum' is defined in assembly that is not referenced". Only difference between my app and the blog is I need to get string value from user. I believe that the error is caused because of the this. I only added "using InteropAssembly" to References section. Screenshot of prototype of source files has been attached and my c# code is follow:

 

private void button1_Click(object sender, EventArgs e)
{
this.pictureBox1 = null;
this.pictureBox2 = null;
string text = this.textBox1.ToString();

LabVIEWExports.main(text, out Image img1, out Image img2);

this.pictureBox1.Image = img1;
this.pictureBox2.Image = img2;

}

0 Kudos
Message 1 of 6
(2,139 Views)

What sort of LabVIEW object are you passing to the two refnum parameters?   If this are not .Net images already you are definitely doing something illegal. LabVIEW refnums are not only meaningless outside of LabVIEW but even outside of the specific LabVIEW runtime kernel instance that created them.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 6
(2,122 Views)

I am passing 2 different LabVIEW images. How can I convert them to .Net image object ?

0 Kudos
Message 3 of 6
(2,117 Views)

By using .Net functions in LabVIEW to copy the contents of a IMAQ Vision image properly into a .Net image object.

And please note that converting images from one environment datatype to another is. one of the more nasty things to do and also in most cases relatively slow since the entire image data needs to be copied. It’s definitely not just the calling of a ready made function. IMAQ Vision knows nothing about .Net Image objects and .Net knows nothing about IMAQ Vision (I believe there used to be a Measurement Studio version of IMAQ Vision but adding that to the LabVIEW/.Net combo only makes things even more complex without solving anything really).

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 4 of 6
(2,113 Views)

Thank you for help but I could not find a built-in function IMAQ Vision image into a .Net image object. I used a function called "To .Net Object.vi", but this is not .Net image object, it is only .Net object.

0 Kudos
Message 5 of 6
(2,106 Views)

There isn’t a built in function for this. IMAQ Vision is not .Net based so it does not support .Net directly. And such a functions is quite complicated to build even for one pixel format but a general purpose method would need to support all of them.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 6 of 6
(2,040 Views)