LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Build .NET Interop Assembly

Solved!
Go to solution

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

 

0 Kudos
Message 11 of 19
(1,468 Views)

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.

0 Kudos
Message 12 of 19
(1,458 Views)
 nsfiltroBW.cnfiltroBW.filtroxVB(ByRef uscita, ingresso)

 this expression doesn't work: "Expression expted." ByRef is underlined in cyan.

?!?!?!

 

Thank you! 🙂

0 Kudos
Message 13 of 19
(1,454 Views)

Sorry. Not sure where my brain was. I program in C#, not VB.NET. The line nsfiltroBW.cnfiltroBW.filtroxVB(uscita, ingresso) should be fine.

0 Kudos
Message 14 of 19
(1,451 Views)

But it doesn't work and I don't understand why...

0 Kudos
Message 15 of 19
(1,450 Views)

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.

0 Kudos
Message 16 of 19
(1,447 Views)

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 🙂

 



0 Kudos
Message 17 of 19
(1,444 Views)
Solution
Accepted by teoprimo

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.

Message 18 of 19
(1,437 Views)

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

 

0 Kudos
Message 19 of 19
(1,431 Views)