LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

invoke node with .net dll return values

Got the invoke node going but having trouble returning the boolean result.  I wanted the return value to reflect the status of an LED.
The return value in the vi is always false, I'm new to all this stuff but have had success getting this going fairly quick.
vi file is attached.
Thanks, Dan
Here's the source from the dll:
 

public

static void SetXplusCurrent(ref bool returnValue, string MinString, string MaxString)

{

string error = CompareAxisMinMaxCurrentValues(MinString, MaxString);

if (error != string.Empty)

{

returnValue =

true;

}

//configTable.XAxisMinCurrentPlus = MinString;

//configTable.XAxisMaxCurrentPlus = MaxString;

returnValue =

false;

}

public static void SetYplusCurrent(ref bool returnValue, string MinString, string MaxString)

{

//call validation function and display any errors

string error = CompareAxisMinMaxCurrentValues(MinString, MaxString);

if (error != string.Empty)

{

returnValue =

true;

}

//configTable.YAxisMinCurrentPlus = MinString;

//configTable.YAxisMaxCurrentPlus = MaxString;

returnValue =

false;

}

0 Kudos
Message 1 of 3
(2,934 Views)
Hi Dan,

You have a flaw in your C# code logic. The returnValue = false statement you have in both methods will always execute no matter what. You have an if statement that might make the returnValue true but then you always hit the returnValue = false statement. You need to have that statement in a else clause. For example,

if (error != string.Empty)
    returnValue = true;
else
    returnValue = false;


If you are still confused, build a little .NET application that references your assembly and calls your static methods. Then single-step into the code to see what statements get executed.

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 2 of 3
(2,922 Views)

Thanks Jonathan, I realized that after I posted.  Too wrapped up in figuring that it had to be something with the interface itself.  Adding the else made it work like a champ.

Spacemann

0 Kudos
Message 3 of 3
(2,920 Views)