NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

multiple numeric test measurment name vb6


I am trying to obtain the names of Multiple Numeric Test measurements from Visual Basic (vb6).
I have read the knowledgebase article 2NE7K56E which gives excerpts from an example for LabWindows/CVI
and am getting closer, but no solution yet.
Here is what I have and the error I get:
 
    Dim stepAsPropObj As PropertyObject
    Dim measAsPropObj As PropertyObject
    Dim sName as String
        :
        :
    stepAsPropObj = currentStep.AsPropertyObject()
    i=0
    Do While (existsMultiResults)
 
        'the following works to obtain upper limit
        limitsArrayHigh(i) = FormatNumber(stepAsPropObj.GetValNumber("result.measurement[" & Format(i) & "].limits.high", 0), 3)
 
        'the following statement gives the error "Specified value does not have the expected type":
        measAsPropObj = stepAsPropObj.GetPropertyObjectByOffset(i, 0)
 
        sName = measAsPropObj.Name   'dont know if this works or not. not getting this far.

    Loop
 
It seems that "result.measurement" has to be specified somewhere,
but everything I try gives a different error.
Can anyone show me how to do this.
Thanks very much.
Jon  
 
0 Kudos
Message 1 of 4
(3,375 Views)
Jon,
 
You are almost there!  Currently you are getting the reference to Step correctly, which gets us half way there.  Now you have to go in and get PropertyObject reference to the Measurement element whose name you want to acquire.  You can do that by referencing the "Result.Meaurement[Index]" PropertyObject.  Once you have that PropertyObject, you can use the PropertyObject's Name property to retrieve the name of the measurement.  Here is a little snippet that describes the process:
 
 
Dim MyStep As [Step]
Dim MyMeasurement As PropertyObject
MyStep = seqContext.AsPropertyObject.GetPropertyObject("Step", 0)
MyMeasurement = MyStep.AsPropertyObject.GetPropertyObject("Result.Measurement[0]", 0)
MsgBox(MyMeasurement.Name)
 
 
Regards,
 
Santiago D
0 Kudos
Message 2 of 4
(3,355 Views)

Santiago,

Thanks very much for your reply. It seems right to me, but when my equivalent to

MyMeasurement = MyStep.AsPropertyObject.GetPropertyObject("result.measurement[0]", 0)

is executed the following runtime error appears: "Object variable or With block variable not set".

This is a vb6 message meaning

"attempted to use an object variable that isn't yet referencing a valid object", or

"attempted to use an object variable that has been set to Nothing"

I assume its referring to "result.measurement[0]", but as I indicated in the first post I am able to reference subproperties of result.measurement[0], e.g, limits, status, etc.

Don't know if you have any further suggestions (but I hope so).  Thanks again.

Jon

 

I

 

0 Kudos
Message 3 of 4
(3,347 Views)

Jon,

I'm not sure at this point why you are getting the error when trying to access the name of the Measurement.  This is one of those cases where it might be easier for me to send you a small example that reads the measurement's name in VB.  This might be easier than me trying to find out what is the difference between your code and mine.

Make sure to re-link the .Net assembly to point to the new location where you decompress the files.

Let me know if this works on your computer and what differences you see between this and your code.

 

Regards,

Santiago D

0 Kudos
Message 4 of 4
(3,333 Views)