NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I use the SetValString method to edit a local TS variable from withing a VB dll?

The following VB snippet yields a runtime error: "Object variable or With block variable not set"

Public Sub SetMyString()

dim object As PropertyObject

object.SetValString "locals.mystring", 0, "IRIS"

End Sub
0 Kudos
Message 1 of 3
(3,390 Views)
Maz -
Typically you need to pass a property object in or pass the sequence context to the method.

Public Sub MyMethod(ByVal oSeqContext As TS.SequenceContext)
Dim oObject As PropertyObject
Dim oMyLocals As PropertyObject

Set oObject = oSeqContext.AsPropertyObject()
Call oMyLocals.SetValNumber("Locals.MyNumeric", 0, 99.9)
...

Scott Richardson (NI)
Scott Richardson
https://testeract.com
0 Kudos
Message 2 of 3
(3,390 Views)
Maz,

You may also take a look at the example titled "Creating a Visual Basic ActiveX DLL and Calling it from TestStand", located at:
http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/82847721827cbc9e86256a30005392eb?OpenDocument

I think you'll find it really helpful.

Regards,

Carlos Leon
0 Kudos
Message 3 of 3
(3,390 Views)