Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you pass opt. arguments to NI-Vision Active-X cont. from .Net C# ?

How do I pass optional arguments to a NI-Vision V8.0 Active-X control from .Net C#?
 
example:
 
maskImage is an optional augument of type object. I have tryed all the common things passing null, creating object and passing null, creating CWIMAQImage and passing null with no luck.

public virtual new

System.Int32 FillImage ( NationalInstruments.CWIMAQControls.CWIMAQImage destImage , System.Single pixelOrReal , System.Object imaginary , System.Object maskImage )

John A. Lively
NDE Engineer
Pratt & Whitney
0 Kudos
Message 1 of 3
(3,047 Views)
Pratt,
 
Have you tried leaving that argument blank.  For example...
 
CWIMAQVision1.FillImage2 (CWIMAQViewer1.Image, 255,,)
 
Take note of the two commas at the end without any arguments between or after them.
 
Tell me if that does not work.  If it does not work, there might be a problem with how .Net is wrapping the Active-X driver.
 
Lorne Hengst
Application Engineer
National Instruments
0 Kudos
Message 2 of 3
(3,034 Views)

In C# you can not leave an argument blank like VB. I did find the solution with more digging in the .Net classes.

System.Object
   System.Reflection.Missing

[Visual Basic]
NotInheritable Public Class Missing

[C#]
public sealed class Missing

[C++]
public __gc __sealed class Missing

[JScript]
public class Missing

Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

Remarks

Missing is used to invoke a method with a default argument.

Only one instance of Missing ever exists.

 

 

John A. Lively
NDE Engineer
Pratt & Whitney
0 Kudos
Message 3 of 3
(3,030 Views)