06-04-2012 04:49 PM - edited 06-04-2012 04:53 PM
Now, I'm not sure about my name!
This is the right version of the project.
About VB.net I'm a noob...
Code:
Imports System.Windows Imports nsfiltroBW Public Class Form1 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim ingresso(2000) As Double Dim j As Integer Dim uscita(2000) As Double For j = 0 To 2000 ingresso(j) = j Next 'usando la DLL 'Dim prova As New nsfiltroBW.cnfiltroBW() uscita = nsfiltroBW.cnfiltroBW.filtroxVB(uscita, ingresso) Dim presi(2000) As Double presi = uscita End Sub End Class
06-05-2012 07:49 AM
The line
uscita = nsfiltroBW.cnfiltroBW.filtroxVB(uscita, ingresso)
is incorrect. Since the function takes in an array as the first parameter, and modifies it, you need to pass the array by reference. This is done by using the keyword ByRef. Thus the line would be
nsfiltroBW.cnfiltroBW.filtroxVB(ByRef uscita, ingresso)
You should not be returning the array as the function's return value if you're already passing it in as a parameter of the function.
06-05-2012 09:21 AM
nsfiltroBW.cnfiltroBW.filtroxVB(ByRef uscita, ingresso)
this expression doesn't work: "Expression expted." ByRef is underlined in cyan.
?!?!?!
Thank you! 🙂
06-05-2012 11:22 AM
Sorry. Not sure where my brain was. I program in C#, not VB.NET. The line nsfiltroBW.cnfiltroBW.filtroxVB(uscita, ingresso) should be fine.
06-05-2012 11:23 AM
But it doesn't work and I don't understand why...
06-05-2012 01:11 PM
I don't know how you can expect anybody to help when all you say is "it doesn't work" without providing any details as to what, exactly doesn't work. If I went to my car mechanic and said "my car doesn't work, what will it cost to fix it?" he'd probably just laugh at me.
06-05-2012 02:16 PM
I said it in a previous post: "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)." 😛
I also add a capture of my screen to make it clear 🙂
06-06-2012 08:41 AM
Sorry, I thought you were talking about getting an error in the VB.NET code. Did you copy the "data" folder that is created by the build of the interop assembly into the VB.NET folder? This folder contains the LabVIEW Advanced Analysis library, which contains the filter funtion your LabVIEW code is using. Thus, your interop DLL and the "data" folder should be in the same folder as the VB.NET application.
06-06-2012 09:32 AM
Ok! You win! 😄
It's easier than I think!
I'm surprised...I've added .dll to the project and VB.net takes a copy of it in project folders without "data".
I suppose that it calls library position and doesn't copy .dll!
Thank you so much