Reputation: 73
i have a button on my FrontPanel in LabView. I created a DLL in VisualStudio that i would like to use in Labview to get the coordinates of that button.
public void GetCoords(Control ctr, out Point p)
{
Point location = ctr.PointToScreen(Point.Empty);
p = location;
}
My GetCoords method uses a "Control" input parameter which is my button in LabView. When i link my button reference from Labview to the method from C# using the DLL i get an error that my reference from my control in labview is not a .NET reference. And yes, its not a .NET control, but what do i use in C# instead of "Control" parameter so i can input my labview control?
So is there any other way to send my Labview button reference to the C# DLL ?
Thanks
Upvotes: 1
Views: 310
Reputation: 11
I don't think the way you want to do it is the best way. If you want the coordinates of the control, just get those coordinates in LabVIEW.
Look at this article: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019S7gSAE&l=en-US
IF you need to you can then pass the specific coordinates to the C# code. But the C# code does not need your control reference.
Upvotes: 1
Reputation: 3163
There is no direct mechanism. You would need to pass the control ref to your C# code, then have the C# code call back into LabVIEW to do operations. It works best if your G code* is a DLL and the C# code calls in to get the ref and then calls in again to get info about the ref. If you try to have G call out to C#, and then want the C# to call back, it’s really complicated to structure.
*G=graphical
Upvotes: 0