LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I input a null value into a .NET method via LabVIEW's Invoke?

Hello,

 

I am using a custom .NET assembly with LabVIEW 10.1. I am using a .NET Constructor Node to create an object, and then using Invoke to call a method on that object. This method takes two parameters, one of which I want to pass in a "null" value. Similar C# code would be:

 

 

MyObject obj = new MyObject();
obj.func(10, null);

 

 

How can I specify this null value using LabVIEW?

 

Also, is there a way to remove private assemblies from the "Select .NET Constructor" window? I updated my private assembly to a newer version, selected it with browse, and a message pops up to say "The version of the assembly you requested was automatically promoted to a later version by the runtime engine." and then select the older version of my assembly. I cannot select the new version of the assembly.

 

Thanks in advance.

0 Kudos
Message 1 of 4
(4,435 Views)

Any advice? Just to clarify the situation, here is some C# code that gives the func prototype:

 

 

public class MyObject
{
  // Snip
  public void func(int a, MyParameter b)
  {
     // Snip
  }
}

// Snip

MyObject obj = new MyObject();
obj.func(10, null);

 

 

So the parameter that I want to specify as null is of a custom type.

0 Kudos
Message 2 of 4
(4,407 Views)

I could have sworn this question had been asked before, but a search only yielded a similar question about passing in a null reference to a string input. I don't know if there's a direct way to create a null object, but you can cheat:

 

Message 3 of 4
(4,395 Views)

Creating a constant from the method's input parameter seemed to work for me...

0 Kudos
Message 4 of 4
(4,150 Views)