08-06-2011 04:38 AM
hi,
I try to pass data to and from a VI I created on my own. And I always get this Exception below when calling vi = lv.GetVIReference(vipath,"",true);.
System.Runtime.InteropServices.COMException (0x00001B21): LabVIEW: Open VI Reference no longer matches VIs in memory by filename. A filename is no longer sufficient because the full name of a VI now includes any owning libraries.
Here is my Code: (It comes mostly from: http://zone.ni.com/devzone/cda/epd/p/id/3838 )
I just edited this part:
private void OpenLV_Click(object sender, System.EventArgs e)
{
//Instantiate a reference to LabVIEW
lv = new LabVIEW.ApplicationClass();
//Set the path to the VI
//string vipath=lv.ApplicationDirectory.ToString() + @"\Examples\General\Strings.llb\Parse Arithmetic Expression.vi";
string vipath = @"C:\Users\Gerhard\FH\sem8\MAProjekt\kompensationsprojekt\code\multiplytest.vi";
//Get reference to that VI
try
{
vi = lv.GetVIReference(vipath,"",true);
}
catch (Exception exc)
{
Debug.Write(exc.ToString() + "\n");
}
OpenLV.Enabled=false;
RunVI.Enabled=true;
QuitLV.Enabled=true;
}
I don't really know what I could do to solve this problem. I tried it for days.
And I attached a screenshot of the VI.
Thx for any quick help!
Meiloy
08-08-2011 12:44 PM
Hi Meiloy,
I see that you're trying to run this code and getting an exception. Looking at the simple VI for multiplication, everything looks good there. Have you double checked that your vi file path is completely correct? Also, you could try copy/pasting the VI into a different file path and trying this again just for troubleshooting.
Also, how are you calling this code?
08-09-2011 12:43 PM
Hi Lea,
I call this code here:
vi.SetControlValue("Numeric",16);
// vi.Run();
vi.Call();
object output = vi.GetControlValue("Out");
When I try to start the VI with vi.Run() I get the following Exception "LabVIEW: The VI is not in a state compatible with this operation.".
I found a website that said that it could have something to do with some editing options, so I set vi = lv.GetVIReference(vipath,"",false); instead of true. But this didn't work as well.
Thanks for your help so far, I can run the vi with vi.Call(). It was the filepath.. spelling mistake.
Meiloy
08-09-2011 01:00 PM
Hi Meiloy,
I'm looking into the issue of the "LabVIEW: The VI is not in a state compatible with this operation." error. I found this link which explains a bit more what the error actually is. What version of LabVIEW are you running?