From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
01-04-2010 08:21 AM
Once you've loaded the prototype, you can access the parameters by using the DotNetModule.Parameters property (returns DotNetParameters which is a collection of parameters for the member in question). You can then access the particular parameter you want using the DotNetParameters.Item() method (returns the DotNetParameter at the specified index). You can then set the value of the parameter using the DotNetParameter.ValueExpr property.
Hope this helps.
01-04-2010 08:30 AM
01-04-2010 08:43 AM
Well, in order to use LoadPrototypeFromMetadataToken(), you must already have a DotNetModule reference to the step. Once LoadPrototypeFromMetadataToken() has been executed successfully, one approach you could take is the following:
for (int i = 0; i < DotNetModule.Parameters.Count; i++)
{
if (DotNetModule.Parameters.Item(i).ParameterName == "name of parameter you want to set")
{
DotNetModule.Parameters.Item(i).UseDefaultValue = False;
DotNetModule.Parameters.Item(i).ValueExpr = "value you would like to set the parameter to";
}
}
Were the links that I provided to the TestStand Online Help for DotNetModule.Parameters and DotNetModule.Parameter in my previous post not helpful?
01-04-2010 08:46 AM
Hello and happy new year!
I think you need to use the function with LabwindowsCVI : setParameterValueExpr
But i have the same problem that you because i can't load correctly the DotNet Prototype and so i can't retrieve the list of parameters.
Please let me know if you have managed to set value for a parameter.
Manooch,
I haven't answered before because I haven't had enough time to try your solution. But i wonder if I can use this (deprecated function)
TS_DotNetModuleLoadMemberInfo (hTSStepModule, &errorInfo, VFALSE, &bHasMemberInfo);
because he seems this function worked previously with TestStand 3.0 ? Without have need of the Metadata Token. So i don't need to use
TS_DotNetModuleGetMetadataToken (hTSStepModule, &errorInfo, &metadata);
TS_DotNetModuleLoadPrototypeFromMetadataToken (hTSStepModule, &errorInfo, metadata, 0, &bHasMemberInfo);
Can you tell me more about this?
Anthony
01-04-2010 08:50 AM
Anthony -
I tried the obsolete DotNetModule.LoadMemberInfo() method but was unable to use it successfully. You should be able to use DotNetModule.LoadPrototypeFromMetadataToken() successfully if you use one of my three mentioned methods of retrieving the Metadata Token.
01-04-2010 04:08 PM
Hi Manooch,
I have to do a challenge in an other thread and i like to use your wrapper.
But it is not working or better .net did a exception. I looked on your src
and found a little mistake why it is not working.
Please fix it
Juergen
01-04-2010 04:22 PM
Juergen -
The example that I posted to this thread was hard-coded to work with the files that I provided. It was merely an example of one method you might use. I call GetType in order to get the particular class whose member I am attempting to get the Metadata Token for. The particular implementation of GetType() that I use requires that you pass a string for the class in question represented by its full name. This includes both the namespace and the class name.
In my example, the namespace for my class is myTestAssembly and the name of my class is Class1, thus, I must pass "myTestAssembly.Class1" to the parameter of GetType to get the Type of my class.
Are you simply trying to run my example or have you attempted to modify the files for your own use case?
01-04-2010 05:00 PM
Hi Manooch,
In your C# you are passing the the string "myTestAssembly.Class1" as parameter to GetType(). Thats well for your example. You have the agrument " string fullClassName " in ...MetaDataToken() which is never used in this code. I saw only the TS side where is a parameter fullClassName. But this one has no affect.
It should be GetType(fullClassName) so it can be controlled by TS.
What i like to do is to create a .net action step type.
To make it available to everybody it should be the member
ComputerSequenceSimulationDialogof class
NationalInstruments.TestStand.Examples.ComputerMotherboard.Computer
in
Computer.dll
(the Hello World of TestStand)
Juergen
01-05-2010 08:23 AM
Juergen -
You are correct that I should be using the fullClassName parameter. I must have forgotten to make that modification after testing out the example. Thank you for pointing that out.
Are you having trouble with anything other than that? If so, please let me know and I will try to help out.
01-05-2010 03:14 PM
Hi Manooch,
Yes indeed, I have some other improvements idea of the GetConstructorMetadataToken, but i have to solution to it.
As you know, i am trying to use the computer class. But there is an other constructor parameter. Instead String, it is SequenceContext.
So i need some interchange abililty with the type array.
Is there a way to define a Type[] -class (Example: Type[SequenceContext,String,Int] if Constructor is MyClass::MyClass(SequenceContext,String,Int) ) in TS and give it as additional parameter to GetConstructorMetadataToken?
Have never done is in TS before. or are there other possibilities.
If with is possible other members here could use it as a very flexible wrapper.
Juergen