LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

.NET Drag Drop error

Solved!
Go to solution

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"

DragDrop_error.png

 

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

Diogo Ribeiro
0 Kudos
Message 1 of 3
(6,484 Views)

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/

 

Diogo Ribeiro
0 Kudos
Message 2 of 3
(6,444 Views)
Solution
Accepted by topic author dcribeiro

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.

Diogo Ribeiro
0 Kudos
Message 3 of 3
(6,423 Views)