06-01-2012 03:58 AM
Solved! Go to Solution.
06-01-2012 07:43 AM
no attachment...
06-01-2012 07:52 AM
I'm sorry 😄
06-02-2012 08:29 AM
I don't understand. I thought you said that you have a .NET interop assembly. Where is the LabVIEW project that created this assembly? Was this assembly created in LabVIEW, or Visual Studio?
If you are calling a static method you do not create an object using a constructor. By definition, a static method is not tied to an object, but to a class. Hence, you would have just the Invoke node.
I don't see your code actually doing anything (usodll VI). There's no arrays, no nothing.
06-03-2012 05:49 AM
First of all, thank you!
I've modified usodll.vi with a simple, complete, example...that it does not work 🙂
Inside "Builds" you will find .Net Interop built in Labview and, in main directory, you can find the project.
I have no skills about .NET this is my serious limit! 🙂
Thank you for your consideration.
06-04-2012 08:07 AM
Define "does not work".
As I noted, when you are calling a static method, do not use a constructor. Delete the constructor and the wire between the constructor and the invoke node.
06-04-2012 08:12 AM
I don't understand why, but this morning it works fine (???)
If i delete the constructor how can I use it?
Can you make me a simple example?
Thank you
06-04-2012 08:41 AM
@teoprimo wrote:
If i delete the constructor how can I use it?
You use it exactly as is. Simply delete the constructor. The VI will still work. As I said, for static methods, a constructor is not needed. Please refer to the LabVIEW Help. It has a page on using static methods and properties. Fundamentals -> Windows Connectivity -> How-To -> .NET -> Using Static .NET Properties and Methods.
06-04-2012 02:40 PM
Ok, it works.
Now, I've to use this .dll in VB.
To simplify the operations, I've built another simple .dll, attached to this post.
Imports System.Windows Imports nsfiltroBW Public Class Form1 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim Input(1000) As Double Dim j As Integer Dim Output(1000) As Double For j = 0 To 1000 Input(j) = j Next Dim prova As New nsfiltroBW.cnfiltroBW() prova.filtroxVB(Input, Output) Dim presi(1000) As Double presi = Output End Sub End Class
I've added my library on Project via Project -> Add reference
There is no error but, when VB calls the library, it opens a white labview interface and it stops to work (no feedback just this interface).
Can you help me?
Thank you so much
06-04-2012 04:30 PM - edited 06-04-2012 04:30 PM
Are you sure you uploaded the right project? The project has no build specifications. Also, that code doesn't make much sense to me. If you're creating static methods from the interop assembly, again, you should not be calling constructor code.