02-26-2015 01:24 PM
Hi all.
I am trying to call a VB .NET application develloped in my company.
The Construtor node returns no errors.
However when I use the Invoke Node to call the Show() method, the following error appear: "DragDrop registration did not succeed"
The application I am trying to call uses drag and drop menus.
But, shouldn't LabVIEW be able to let those run?
Is there a work arround for this?
I am using LabVIEW 2014 32-bits and .NET framework 4.5.
Thanks in advance for all the help.
Regards,
Diogo Ribeiro
Solved! Go to Solution.
02-27-2015 11:15 AM
Hi all.
Here are some more informations about my error:
The error details I got are:
************** Exception Text **************
System.InvalidOperationException: DragDrop registration did not succeed. ---> System.Threading.ThreadStateException: Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.
at System.Windows.Forms.Control.SetAcceptDrops(Boolean accept)
It seems that the method System.Windows.Forms.Control.SetAcceptDrops(Boolean accept) is failing...
But why?
Anyone has some ideia?
Thanks for the help
This topic is duplicated in https://lavag.org/topic/18845-net-drag-drop-error/
03-01-2015 07:42 PM
Thanks to the help of the user JKSH in the lavag forum. I was able to find the solution in the following topic: http://forums.ni.com/t5/Measurement-Studio-for-NET/Calling-net-dll-in-Labview/td-p/803084
The solutions was reported by the user nickb, in the 1st response of the topic
Thank you so much!!
So, the simple approach to solve the problem is to change the way LabVIEW calls external applications (in this case .NET).
By changing it in the VI execution properties. The Preferred Execution System option needs to be changed from "standard" to "user interface", as it is in the next figure:
Hope this can help other LV users.