Pass object reference from TestStand to C#

Hi,
I have created a GUI in .NET which i invoke in TestStand (through a custom step type). User can enter a object reference teststand variable in the UI input expression box. So i need to get the object value in that variable and use it to call some .net functions. To get the values from expression box of UI and put in TestStand step variable i use:
         PropertyObject.SetValInterface("Step.TestStationObj", 0, tsexprTestStationObj.DisplayText.Trim()); To check the value in the step variable if i do:
         MessageBox.Show("TestStation obj after setting:",PropertyObject.GetValInterface("Step.TestStationObj",0).ToString());
But i do not get any value. Guess it is null. Is this a correct way? My intension is to get the value corresponding to a teststand object reference and pass it to C#. The C# UI control is of type NationalInstruments.TestStand.Interop.UI.Ax.AxExpressionEdit

Thanks Andy.
I still get the error when i am trying to pass the object created from C# to Teststand. I have explained what i am trying to do. Kindly requesting your assitance on this issue.
I have 2 classes in C# (code given below), I am trying to pass the object of "Counter" (c1) class from the "Mainfrm" to teststand. In teststand(counter.seq), I am trying to access the function "GetCount() and SetCount()". I have attached the snapshot of the error that i get from teststand.
Class Counter
    private int count;
    public int GetCount ()
       return (count);
    public void SetCount(int _count)
       count = _count;
Class Mainfrm : Form
    public Counter c1;
        private void Mainfrm (object sender, EventArgs e)
            InitializeComponent();
            axApplicationMgr1.Start();
            mEngine = axApplicationMgr1.GetEngine();
            currentFile = axApplicationMgr1.OpenSequenceFile(@"Counter.seq");
            pobj = mEngine.NewPropertyObject(NationalInstruments.TestStand.Interop.API.PropertyValueTypes.PropValType_Container, false, "", 0);
            pobj.NewSubProperty("Parameters.ObjRef1", NationalInstruments.TestStand.Interop.API.PropertyValueTypes.PropValType_Reference, false, "", 0);
            pobj.SetValInterface("Parameters.ObjRef1", 0, (object)c1);
            mExecution = mEngine.NewExecution(currentFile, "MainSequence", null, false, 0, pobj, null, null);
Attachments:
ErrorFromTestStand.JPG ‏28 KB

Similar Messages

  • Find memory leakage when passing Object Reference from Teststand to vi

    I am using Teststand to call labview vi, and pass ThisContext of sequence to vi as object reference, but if I just loop this step and I can find the memory using keep increasing, how can I avoid the memory leakage inside the vi.
    see my vi, it is to post message to UI.
    Solved!
    Go to Solution.

    You should be using a close reference node to close the references you get as a result of an invoke. In the code below you should be closing the references you get from the following:
    AsPropertyObject
    Thread
    Close those two references once you are done with them.
    Also make sure you turned off result collection in your sequence or you will be using up memory continually for the step results.
    Hope this helps,
    -Doug

  • How do I get an activeX object reference from a LabVIEW ActiveXContainer ref?

    How do I get an activeX object reference from a LabVIEW ActiveXContainer ref?
    I'm trying to control an ActiveX object (a Web Browser) from another VI and need to get the object reference programmatically. I can get the LabVIEW ActiveXContainer reference, but am lost on how to get the reference for the object _inside_ the container.

    Hi Lee,
    The reference to the container is actually also accessing the object inside the container. Use the Property Node and Invoke Node to access properties and launch methods for the object. I've attached a small example that passes the reference to a SubVI and invokes a method inside the SubVI.
    - Philip Courtois, Thinkbot Solutions
    Attachments:
    WebContainer.zip ‏21 KB

  • How to get caller object reference from a method

    Hi,
    I am working a already existing Java Swing project, now I got a problem, in a method I need to get the caller object reference otherwise, I can't succeed this operation. So please tell me a way how to get the caller object reference from a method. that method would be static or regular method anything will do for me.
    Edited by: navaneeth.j on Jan 29, 2010 11:20 PM

    navaneeth.j wrote:
    Actually my doubt is, I have a method "addition" method, which is using by many classes so my requirement is in the addition method I want to write a code snippet which will identify and get the the caller object. Actually I tried Reflection.getcallerclass but there I am getting "CLASS" object not the actual object reference, but I want object reference.
    Actually we have a huge project which is writen plain JAVA, so in this project the authors written the Database connection package for single database transaction. so now we are using this project source code for JSF application in this web application the DB package has serve based on the dynamic db connection parameters, so if we want to change this package fully means need to solve the dependency problem in hundreds of classes, so my point is if I can access the caller object in the DB package when ever it gets called by any class from any where of the project. So actually I liked Reflection.getcallerclass, the way of implementation perfectly works for me but it is not giving caller object reference, if something gives the caller object then I can get the DB connection parameters then there is no need to pass the parameters in the hierarchy.You can add a parameter (of type Object) to your addition() method
    and everywhere you call the addition() method also pass this (which from the POW of the addition() method will be a reference to the calling class instance).
    There may be alternative solutions
    but none that require less effort.

  • What is the use of passing object reference to itself ?

    What is the use of passing object reference to itself ?
    regards,
    namanc

    There is an use for returning an object reference from itself, for instance:
    class C {
    public:
         C append(C c) {
             // do something interesting here, and then:
             return this;
    }You can "chain" calls, like this:
    C c = new C();
    C d = new C();
    C e = new C();
    c.append (d).append (e);Maybe the OP has "inverted" the common usage, or thought about a static method of a class C that requires a parameter of type C (effectively being a sort of "non-static method").
    class C {
        static void doAnotherThing (C c) {
            c.doSomething(); //-- effectively C.doAnotherThing(c) is an "alternative syntax" for c.doSomething()

  • Line Chart: It is possible to get the object reference from a flash chart

    Hi Folks,
    hope you feel well ...
    I wan't to get the Object Reference from a Chart Flash Object using javascript in the HTML Header of a Apex Page.
    It's long time ago with Oracle/Java and so my skills are really shity :-)
    The Functionbody works, but the following error occurs: chart.refresh is not a function
    It is necessary to CAST it ? with the Class AnyChart.js ?
    After 5 hours i give up ^^ is this kind of object handling possible ? THX4HELP@ll
    Apex Page HTML Header
    <script type="text/javascript">
    function hideSID2()
    var chart = document.getElementById("*c7067437546726610*");
    chart.refresh();
    </script>
    HTML File at runtime:
    <div class="rc-body"><div class="rc-body-r"><div class="rc-content-main"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
    width="1400"
    height="600"
    id="c7067437546726610"
    align="top"> ...

    If you are using adobe Flex Builder to develop SWF, please be sure using ExternalInterface class to expose the refresh() method.
    then you can should be able to call this method in Javascript.

  • ExternalInterface: pass object reference across interface - how?

    I want to invoke methods on specific Javascript or
    ActionScript objects through calls across the ExternalInterface
    barrier. I would like to be able to do this either AS -> JS or
    JS -> AS.
    So I would like to pass an object reference across the
    interface. I'm not sure exactly what *is* getting passed (is it the
    serialized value of the object?), but it doesn't seem to work as an
    object reference.
    Here's a notional code sample. I have two symmetric object
    definitions, one in Javascript, one in ActionScript. During
    initialization, one instance of each object will be created and
    given a pointer to the other. Then they should each be able to
    invoke a method on the other to "do stuff".
    //----------[ code ]---------------------------------
    //--- Javascript ---
    class JSobj {
    var _asObj;
    JSobj.prototype.setASObj = function(obj) { _asObj = obj; }
    JSobj.prototype.callASObj = function(foo) {
    callASObjectMethod(_asObj, foo); } // does: _asObj.asMethod(foo);
    JSobj.prototype.jsMethod = function(bar) { /* do stuff */ }
    function callJSObjectMethod(obj, args) { obj.jsMethod(args);
    //--- ActionScript ---
    class ASobj {
    var _jsObj;
    public function set jsObj (obj:Object):void { _jsObj = obj;
    public function callJSObj (foo:Number):void {
    ExternalInterface.call("callJSObjectMethod", _jsObj, foo); } //
    does: _jsObj.jsMethod(foo);
    public function asMethod (bar:Number):void { /* do stuff */
    function callASObjectMethod (obj:Object, args) {
    obj.asMethod(args); }
    ExternalInterface.addCallback("callASObjectMethod",
    callASObjectMethod);
    //----------[ /code ]---------------------------------
    My workaround is to pass a uint as an opaque handle for the
    object, then resolve it when it is passed back. I'd rather pass a
    real reference if possible. Is there a way to pass object
    references between JS and AS?
    Thanks,
    -e-

    It's an object of a class that extends Object. I guess the answer is no then.
    Thanks for your answer

  • Any Resources for Learning Object Reference in TestStand?

    Hi All,
    I have been using Active X servers in TestStand for several years and now some of the newer stuff I am being supplied with is Dot Net objects. Does anyone know of somewhere to learn the correct way to use object references in TestStand. I don't understand when you should create a new object  vs just using an existing object reference. I also would like to understand how to use an object reference variable.
    I looked at the TS examples, but there is not an explanation. 
    Any ideas?
    TIA,
    Jim

    Jim,
    You may try reading through the NI TestStand Advanced Architecture Series, specifically Chapter 2: Using the NI TestStand Object Model. These may shed some light on the issue.
    Regards,
    Steven Zittrower
    Applications Engineer
    National Instruments
    http://www.ni.com

  • Passing an ActiveX reference from TestStand to Labview

    How can I pass and ActiveX reference (for a dll) created and used in a TestStand sequence (under Locals) to a VI running within that sequence so that I can then call the same instance of the dll from Labview?
    (I know this isn't the best approach to programming but I'm more interested in proving the point than anything else)
    Cheers
    Dan

    Here's what I think you are tyring to do. Within your sequence, instantiate an object from an ActiveX DLL, storing a reference to it within a TS variable. Then, within a VI called by this sequence, call a method of the intantiated object.
    To do this, when specifying your module on your LV step you must check the Sequence Context ActiveX Pointer check box. In the called VI you must have the a Sequence Context control on your front panel and have it wired to your connector pane along with a TestData cluster control and a LV Error Out cluster control.
    Within the VI you use an invoke node to invoke the AsPropertyObject method on the SequenceContext (Make sure you use the ActiveX close function on this new reference when you are done with it.). Use another invoke node to call GetValInterface method on the sequence context property object reference (you could probably also use the GetValIDispatch method. See the help). For this invoke node you will want to use a lookupstring that reference the variable, relative to yo sequence context, in which you stored the refernce to the instantiated object in your sequence file. This will return a variant reference. You must convert this reference to a LV reference using the "To G Data" function in the ActiveX palette. The "To G Data" function requires a type input. You will need an ActiveX Automation Refnum control as the input to this (see ActiveX control palette). You will need to right click on this automation refnum control and browse the ActiveX automation server until you find the DLL ActiveX server from which you instantiated your object within your sequence. Once selected, also select the object that you instantiated. The "To G Data" function will then give you a reference to you object on which you can happily used in your desired manner. Make sure to close this reference with an ActiveX Automation close function when you are done with it.
    I would definitely clean this up with a subVI to perhaps generalize the solution.

  • A simple teststand applicatio​n passing object reference to C#

    Hi,
     I have a  .NET application written in C# which has a UI with  NationalInstruments.TestStand.Interop.UI.Ax.AxExpressionEdit controls. This UI is invoked by a custom step in TestStand. One of the values, entered by user in the UI is a object reference variable created in a previous step. I need to store the values entered in the UI during the edit mode of the step, into the TestStand Step variables. And during the run mode i use these values to execute the logic in C#. 
    The problem is during edit time, the object reference variable, entered in the UI, has no value. It is null. So there is no use storing it at edit time. During the runtime i am trying to retrieve the value of the object reference variable using GetValInterface(...) and GetValIDispatch(..) methods of PropertyObject. But the object returned to C# is of type System.__COMObject wherease in TestStand that object reference is of type .NET.
    I don't know how a .NET object reference is converted to COM object when it is returned to .Net function.
    Also is there any other method to send this object reference variable's (whose value is '.NET' in previous step itself) value to .NET as a .NET object only so that i can typecast to appropriate type and start using.
    Thanks.
    Please let me know if anything is not clear.
    I have attached the .Net project, .ini file for the custom step and a example sequence file.
    Attachments:
    CCustomStepObj.zip ‏23 KB

    Hello Shivapriya,
    The example you've sent doesn't compile. And it without it I'm affraid I do not understand the problem you're describing.
    You've given references to libraries that you've not attached with your files.
    For the C# I see these are the
    IADCore.dll
    InstrimentInterfaces.dll
    TestStand also seems to want to reach for the assembly named TestSystem.dll.
    I can only tell you that I have used successfully in the past the Variables in TestStand to hold .NET object references, and call methods on them and I experienced nothing similar that you describe, but I don't quite follow what is the problem here, as I can't use the example. 
    I would appriciate if you cold narrow down the example to 1 dll or something where the problem occurs and than resend it.
    Regards,
    Maciej 
    Message Edited by Mac671 on 09-28-2009 02:59 AM

  • Passing object references to methods

    i got the Foo class a few minutes ago from the other forum, despite passing the object reference to the baz method, it prints "2" and not "3" at the end.
    but the Passer3 code seems to be different, "p" is passed to test() , and the changes to "pass" in the test method prints "silver 7".
    so i'm totally confused about the whole call by reference thing, can anyone explain?
    class Foo {
        public int bar = 0;
        public static void main(String[] args) {
                Foo foo = new Foo();
                foo.bar = 1;
                System.out.println(foo.bar);
                baz(foo);
                // if this was pass by reference the following line would print 3
                // but it doesn't, it prints 2
                System.out.println(foo.bar);
        private static void baz(Foo foo) {
            foo.bar = 2;
            foo = new Foo();
            foo.bar = 3;
    class Passer2 {
         String str;
         int i;
         Passer2(String str, int i) {
         this.str = str;
         this.i = i;
         void test(Passer2 pass) {
         pass.str = "silver";
         pass.i = 7;
    class Passer3 {
         public static void main(String[] args) {
         Passer2 p = new Passer2("gold", 5);
         System.out.println(p.str+" "+p.i);  //prints gold 5
         p.test(p);
         System.out.println(p.str+" "+p.i);   //prints silver 7
    }

    private static void baz(Foo foo) {
    foo.bar = 2;
    foo = new Foo();
    foo.bar = 3;This sets the bar variable in the object reference by
    foo to 2.
    It then creates a new Foo and references it by foo
    (foo is a copy of the passed reference and cannot be
    seen outside the method).
    It sets the bar variable of the newly created Foo to
    3 and then exits the method.
    The method's foo variable now no longer exists and
    now there is no longer any reference to the Foo
    created in the method.thanks, i think i followed what you said.
    so when i pass the object reference to the method, the parameter is a copy of that reference, and it can be pointed to a different object.
    is that correct?

  • How do you pass vi references from one event to another

    I have a vi which gets vi references (thereby loading the vi's into memory) for all the vi's in a given directory when a user clicks a button on the front panel. To do this I use an event structure. My question is whether it is possible to have another event (user button on the front panel) which unloads the vi's from memory. I have tried passing the vi references that are initially generated to the close reference function but whenever I do I get a 'vi reference invalid' error. Does this have to do with trying to pass the vi references between one event and another? If I use a local variable simply pass a reference to another indicator and then probe it, the originally-generated refnum and the local vari
    able refnum match up. However once I try to wire that same indicator to the close reference function I get the 'vi reference invalid' error. Is there a different/better way to unload the vi's from memory based on a user button click? Any suggestions would be welcome.
    Jason
    Attachments:
    Load_Directory_of_vi's.vi ‏57 KB

    Several problems with your code:
    1... Bad idea to use lights as buttons. Yes it can be done, but it's not "natural".
    2... If you've gotta do that, set their mechanical action to "LATCH WHEN RELEASED"
    3... Because of #2, you are getting TWO copies of every array when you click the LOAD VIs light (er... button).
    4... No need for the conversion from path to string and back - use BUILD PATH to append each file name to he folder path.
    5... Set the BROWSE OPTIONS on your PATH control to EXISTING DIRECTORY to allow browsing of directories, not files.
    6... Your code doesn't care whether the file is a .VI file, or a .ZIP file, or a .TXT file, or what. Use the PATTERN input on the LIST function to discriminate.
    7... Your code is only storing the latest refer
    ence, not the array of references.
    8... An ERROR DIALOG on the OPEN REFERENCE function will tell you that you're getting an error. Why? You are asking to prepare a non-reentrant VI for reentrant execution (why use options = 8?)
    9... Because of #8, the latest VI reference is invalid.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • Passing object references via methods

    Why is the JFrame object not being created in the following code:
    public class Main {
      public static void main(String[] args) {
        Main main = new Main();
        JFrame frame = null;
        main.createFrame(frame);  // <-- does not create the "frame" object
        frame.pack();
        frame.setVisible(true);
      private void createFrame(JFrame frame) {
        frame = new JFrame("createFrame");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }Thanks.

    These explanations are great; real eye openers.
    OK. This could be a "way out in left field" question. I am just starting out with Java. But I want to ask:
    Objects are stored in the heap?
    Object references and primitives are stored on the stack?
    Adjusting heap size is straight-forward. A larger heap can store more/larger objects. What about stack sizes?
    C:\Dev\java -Xss1024k Main
    I assume this refers to method's stacks. But, what about object scoped, and class scoped, object references?
    public class Main {
      private static List list = new ArrayList(); // class scoped
      private JFrame frame = new JFrame();  // object scoped
      public static void main(String[] args) { ...... }
      private void createFrame() { .... }
    }How is the reference to list and frame stored, with regard to memory management?
    Do objects have stacks?
    Do classes have stacks?
    If not, how are the list and frame references stored (which helps me understand reference scoping).
    Would the overflow of a method stack (ex. via recurssion) also overflow the method's object and the method's class stacks?
    If these questions are stupid, "out of left field", don't matter, etc. Just ignore them.
    But the knowledge could help me avoid future memory related mistakes, and maybe pass a "Java Certified Developer" exam?
    My original question is already answered, so thanks to all.

  • AIR 3.4: Access Object reference from different sandbox

    I have an application that loads a local HTML-Page which contains an iFrame displaying a remote website:
    <iframe id="iframe" width="100%" height="100%" style="margin:0;padding:0;" frameBorder="0" documentRoot="app:/www/" sandboxRoot="http://remoteserver.com/mypage" allowCrossDomainXHR="allowCrossDomainXHR" ondominitialize="engageBridge()" > <p>Your browser does not support iFrames. Learning object cannot be loaded.<p> </iframe>
    The Website in the iframe should be able to access a JS-Variable in the local HTML. Is this possible?
    I read the articles about Cross-Scripting between sandboxes and parent-child-bridges, but as far as I understood it this is only for simple objects, which are stringified and then parsed again. What I need is a direct links from the remote website to the Javascript in the local page!

    Hi Pete,
    To package your app with a provisioning profile (enabled with Apple Push Notifications Services) you don't have to provide the application identifier and keychain-access-groups in the entitlements .Just the following entitlements will work :
    <Entitlements>
                <![CDATA[
                           <key>aps-environment</key>
                           <string>development</string>
                ]]>
    </Entitlements>
    instead you've to provide the app-id in the <id> tag of the app-xml like just another AIR-iOS app(I know that Flash Builder changes the app-id to "app-name.debug" but you can change it while packaging and one strong reason to recommend this way is that for the testing I have uploaded a test app at app-store to validate these entitlements and Apple has approved it.) in following way:
    <id>com.kiwiworks.cnn</key> //Remove the Bundle Seed ID from here.
    If you've any questions then please feel free to ask.
    -Nimisha

  • Passing object reference array to a method

    Hi everyone,
    I'm new to the java programming language. I want to create create a array of 50 objects and pass them in to a method in other class.
    Can anyone help me on this problem........................
    Chathu.

    Object[] objectArray = new Object[50];
    objectArray[0] = "Hello World";
    objectArray[1] = new Integer(42);
    myClass.myMethod(objectArray);

Maybe you are looking for

  • Will I lose my Unlimited Data plan?

    Hi, I currently have an LG Vortex, which I got sometime in June of this year when I was scheduled for an update. Obviously, my phone isn't ready for an update yet, but if I take in a phone I already have (such as my father's, which he's giving me bec

  • ITunes log in error

    When I am trying to sign in to my itunes store the following message is showing "We could not complete your iTunes store request. An unknown error occurred (-50)". Can any one tell me the solution to this problem? Thanks, Buddha

  • My ipod cant connect and sync with itunes?

    its shown under devices but says "cant connect with sync services."

  • Date time data altered by edit

    I have been struggling with what seems to be a significant bug in Photoshop Elements 9. When I edit a photo (creating a version set), the date/time stamp on the original and edited photo takes on the date and time of the edit and not the original dat

  • Can I update PS CS5 NFR to CC somehow?

    Hey everyone. I have a Photoshop CS5 NFR box which I never opened. I remember I saw some discounts on moving to PS CC from CS6, can you please tell me if I can get a discount on buying Photoshop CC with PS CS5 in my hands? Many thanks, Sergey