Change local variables with dll c#

Sub AppMgr_UserMessage (UIMessage uiMsg)

{

Try

{

switch ((int) uiMsg.Event)

{

10200-case: //update the UI to reflect the current status

progressBar.Value = (int) uiMsg.NumericData;

label. Text = uiMsg.StringData;

break;

10201-case: //Close form, cleaning of the AppMgr reference

AppMgr = null;         This. Close();

break;

//=========================================================

10202-case: / / send the text to the caller App test bench

label. Text = "10202."

uiMsg.AsPropertyObject (). SetValString ("Locals.opText", 0, "Something");

break;

//===========================================================

It is a code in your example of Panel floating .net

In the last case above trying to change one of the local variables of the test bench. I think that it is probably not wise to cast as a how PropertyObject uiMsg which I have here.

I think it is more likely that I'll have to pass the variable I want to change benchmark to the DLL.

Don't know how to do this, any ideas?

Hi Krugman2,

To do this, you need the coresponding SequenceContext!

Try uiMsg.Thread.GetSequenceContext(0,frameId). AsPropertyObject()

Maybe this thread could be interresting:

http://forums.NI.com/NI/board/message?board.ID=330&thread.ID=17870&view=by_date_ascending&page=1

Greetings

Jürgen

Tags: NI Software

Similar Questions

  • Change local variable boolian Programaticaly

    Hi all

    I came across something today, that I have ever dealt with in Labview...

    I downloaded a driver of instrument for a power supply, and got it working OK (using VISA on the USB communication).

    The example program pilot itself works very well and is a quasi State machine.  It it turns on and off and adjusts the voltage and current correctly, as it should.

    Then I need to edit the .VI to add a time on another timer .VI.  I wrote that the small simple VI and it works properly as it should.

    It's just a boolian power timer.  Lights at 08:00 daily, stops at noon every day.

    The problem I have is the boolian called variable "Output (T:Enable)" which is located in the .VI power supply example is a Panel button, but it is called several times as a local variable.

    (once again, I did not write this part and please no lectures on why you should never use a local variable...)

    When you change the State of the button "Output (T:Enable)" Panel, the power supply turns on and off as it should.

    The problem comes when I try to control this value boolian using my timer VI.  I've tried several things, and using debug, I can't 'Output (T:Enable)"to change state.

    The value will change ONLY if the button is pressed or not.

    ATTENTION: The illustrated local variable condition is also a security in case of short or overload, power off if the name cannot be changed.

    Is there a way I can trigger "Output (T:Enable)" using 'My exit timer' but always make sure that stop you it if there is a short circuit?

    This left me speechless... I tried several different things and just can not understand.  Any help would be appreciated.

    Thank you!

    The guy

    Hello guy!

    You are not sure, I understand the problem in its full extent, but I'm guessing that you want to trigger the event that controls the output (T: Enable)? If you want to programmatically, create a node of the control property and use the property "value (follow the signs). Writing of a local variable will not draw the event, although this will change the value of the façade.

  • Local variables with cross dimensional operator

    Hello

    I have a business rule that has the following calculation:

    VAR TOTPROD;
    TOTPROD = "Prod1" + "Prod2" + "Prod3."

    "MBR1" = "MBR2"->"Jan"-> TOTPROD / "MBR2"-> "YearTotal"->"TotalProducts";

    The statement above does not work for obvious reasons, that TOTPROD is not a member name.
    Is it possible to use a local variable in a cross dimensional operator statement?
    I want to use the local variable in order to avoid another hierarchy.

    I use Essbase / DGPS 11.1.2.2

    Help, please.
    Thank you.

    Hello

    As you say, I don't think that the approach you have will work.

    What is to be

    a. creating dummy product member in your plan and put your result on it (or use an existing Member of "dummy" product)

    b. re - write your code to handle you want to... do something like (assuming you add Prod1, 2 and 3):

    'MBR1' = ("MBR2"-> "Jan"-> "Prod1" + "MBR2"-> "Jan"-> "Prod2" + "MBR2"-> "Jan"-> "Prod3") / 'MBR2'-> 'YearTotal"->"TotalProducts ";

    Not sure if I'm missing something here, but or one of these suggestions do not help?

    JB

  • Local variables are comparable to the value property of a control or indicator?

    I use the buttons / switches mechanical locking action, event structures and local variables to track the status of my switches.  I used local variables with indicators, too.  Now I see that this could be done via the node property of a switch or an indicator.  Should I use the nodes property instead of local variables?  Should I use "switch" mechanical action and control the State of the control buttons / switches?  I used a mechanical locking action because it automatically reset when it is read, but who pushed me in the use of local variables.

    I know the property values to adapt the data flow model, while local variables might be placed in a sequence structure to ensure the order of execution.

    I just don't want my program all except if it is a correct approach.

    Thank you

    DH

    Dark Hollow says:

    Well, I'm changing the properties of user interface in my state machine.  For example, when you push a button to START the TEST, I want to disable and gray this button and activate the button to STOP the TEST.

    No engineer too much. In this case, you can use a single button and label the FALSE case a 'start Test' and the REAL case as TEST 'STOP '. No additional code needed at all. At the same time, you only use the half-Panel space! (and 10% space diagram!)

    Dark Hollow says:

    Another example... I have a couple of dozens of LEDs on the front panel to show the TEST SUCCEEDED.  If I have the wiring all of them, my state machine diagram gets messy.

    Define disorder! In my mind, code is not held together by wire is much messier because it is impossible to determine the order of execution and so program logic. A thread is a small 1 d object. A property node is a significant 2D object. 20 wires are much less messy than 20 knots of property, especially given that each property nodes still hanging by a thread in one way or another!

    In order to reduce the number of threads, use the most appropriate data structures. Instead of a few dozen sighted use a single Bay of LED. A single wire! Keep the table in a shift register and update alone LED as necessary by using "replace subset of the table".

  • Shift register to replace local variables

    Hello

    I'm looking for a way to make a marquee on a Boolean LED. Currently, I use a local variable to make the scrolling action (see the code, the loop For on the right). However, this method requires CPU more power and also prone to several other error. Therefore, can someone help me to replace local variables with shift register? If possible, do not change the other loop. Thank you.

    -l' scrolling action must be continuous

    -use the attached config. file

    -allows to test with any text message

    Why do you think that you need so many loops?

    Try this, perhaps this may give you some ideas...

    (Look at buffer allocations. My table of Boolean 2D works at constant size and completely in place. Not only were constantly read and write to and from the local variables, you were also constantly growing and reducing the size of the table. It's very ineffiicient. I don't see the purpose of your outside while loop or FOR your first loop. None of your shift registers makes a lot of sense. You probably want to close the file of configuration (not shown in my modification)).

  • Copy a structure of event containing local variables

    Hello

    I am a state machine design in Labview and next state transition logic to wait be clicked a few buttons on the Panel.

    If I press a Boolean button from 1 to 9, next State should be X, otherwise condition (10 to 16 tags) should be there.

    I thought that the right approach, because it would be a structure of the event, where I added two cases: case 1 (button 1: mouse to the bottom button 2 down,..., 9 of the mouse down) and box 2 (10 mouse buttons down,...). For each of these cases, I'm reading & writing the local variable of some double digital.

    When I copy the structure of the event in another case of structure of outer case, I note the following: all cases in the event loop is missing, and the local variable renamed automatically and a new created indicator digital.

    • How to make an exact copy of the structure of the event, without the problems described above?
    • Could you suggest a different approach more effective than mine?

    Thanks for any response.

    Start by reading the guard and recommendations for using events in LabVIEW - LabVIEW 2011 help

    The fact that you try to copy and structure of the event to another, and that a structure of the event will be buried in a case initially tells me you are already heading on the wrong track and yourself in creating a world of problems.  Your architecture will never seem to work for you.

    The event structures are always active and capture events.  Even when the structure of the event is not in the path of execution, it's queue of events to which he attributed to him.  If you have events that are set to lock the façade until full, then you're really screwed because the event structure will capture the event, locking of the front panel and the execution path of your code with the state machine may never come to the specific case that has captured the event to support then release the façade.

    In general, you should have the structure of a single event in a VI, and should not be buried in a case structure where he can never carry.  You also shouldn't have several event facilities manage the same events.   These are not hard and fast rules, but until you are quite familiar with how the event structures work and completely understand the architecture of your code, you should not violate or you will just ask trouble.

    Similarly with the help of local variables.  The fact that you say that you have local variables and you try to copy tells me that you already have too many.  There is certainly a better way to build your VI, which does not require local variables with the exception of a few cases and certainly won't need several structures event buried in the structures of the case.

    You should probably have a producer/consumer architecture that handles the events.  Have a simple loop with a structure of the event which captures all user interactions.  Pass events to a loop of consumer who is also your computer through a queue of State.  (Also known as a computer state in queue or the BAU).  Let the state machine to determine how to manage the events, he received based on what is the current state of the VI.

  • How can I get the changed data in a def type control containing an Xcontrol with a local variable

    Hello

    I did an Xcontrol and I inserted this control in a def type.

    When I want to change the data of the control with a local variable in a VI the VI change nothing. The change of the data is not complete

    How can I fix this problem?

    Thanks for your help

    Hello

    What is your version of LabVIEW? You have a simple example program that demonstrates this behavior?

    I found an other discussions related to your problems with Xcontrols:

    update of type defs Xcontrol faade

    No data change event generated for an XControl in a Type definition

    XControl facede.vi

    I hope this helps.

    Kind regards

  • How to set multiple values clustered with local variable?

    Hi all

    Okay, I made my way through Labview for everyone and have some basic concepts down. I can see with a cluster, if acting directly on it, you can ungroup, change values, rebundle, etc..

    I try something a little more complex... and just do not know how to start on this.

    I have a menu menu ring set. I created this with a typedef, with 4 values.  I used this typedef 7 times, more a few LED bool, in a cluster. I made this cluster a typedef.

    Therefore, in my main vi, I started designing, I put an example posted here... and inside, I have two instantiations of the typedef cluster commands selection of left and right.

    I dropped in this vi, a copy of the menu ring typedef (same typedef as in clusters, values) called reset all tubes.

    Now, I am trying to understand how, with an event to change the value to 'reset all the tubes'... that I can start with the left switch and change all tubes (here is the menu ring selector) to the same value as what has been selected with the ring of menu 'Reset all the tubes'.

    I created a local variable for the selector on the left. It is configured to read values. (I'll be doing the same thing with the right too, but just to start with the left).

    In the examples I've seen where access to a cluster, you could ungroup the cluster... browse and change the values... maybe pull out all the "hits" in a table and go through to update the values.  And when you group or ungroup the bunch... you can see the values, etc., when you stretch on the block diagram.

    With the local variable... I do not see to 'stretch' it as I expected... so I can access the values "tubes"... and all at the value of the 'reset all the tubes' ring menu value.

    Someone can put me on the path on the best way to do... or is it a component structure I'm missing here?  Am that I on the right track everything first here?

    It seems pretty basic to me, but miss me just something here on the way to start...

    Thank you in advance,

    Cayenne

    You can't do this with a for loop of how the Department is structured, but why make it so complicated?  Just group the new value in the cluster, as shown below:

    If you do not want to use a loop for example, consider the restructuring of your cluster.  Group ring and a Boolean value in a cluster, and then unmold 7 of those in the cluster of selector.  Then you can use 'cluster to the table' and 'picture of cluster' for all elements of the external cluster will be of the same type.

    Also, be careful when using rings in the form of type definitions.  You probably want to use an enumeration instead.  The elements of a ring do not update the when you update the type definition because they are considered to be cosmetics. the elements of a definition of enumeration type update, because the elements of an enumeration are considered as part of the data type.

  • LabVIEW: Concerns with local Variables and the readability of the program

    Hello everyone. I was hired for the summer to work at my University to a new laboratory. All right, but I have some problems with my main VI. I am a new user of labview coming from a C++ background. I went through several iterations of adding features, fixing bugs and doing my readable program. Before the last "cleaning" my program was so big that I couldn't see it all at once on my screen. My goal was to solve this problem. My solution contained three parts: use a state machine show parts of my code at the same time, to remove the son as much as possible, and use structures element to position my code manually.

    I met since problems write other programs that brought me here, and I saw a series of messages condemning the new programmers for their use of local variables instead of cables. I do not know my use of structures element as fancy boxes I can exclude the automatic cleaning is also a terrible practice.

    After doing some more reasearch on the subject I see local variables to add the duplicate in memory entries and their suppression can significantly speed up execution time. I have a delay programmed in a part of my code, but the rest can run as fast as he can as far as I'm concerned.

    I have attached my main program. Looking at it I think I did a good job to make it readable. But I'm not a user expert labVIEW.

    How to balance (do not use local variables, these structures element, etc.) efficiency and readability. Before you make these changes, there was so many things and so many threads all over the place that I couldn't even tell what was going on, and even less my teacher. I really wish I could see my entire program without scrolling on this computer of the laboratory (resolution 1280 x 1024).

    Advice on how I can achieve the efficiency, simplicity and common readability would be greatly appreciated. I feel I've done the latter while sacrificing the first two. Ultimately the three should probably be equally important.

    Thank you.

    Nukem

    LabVIEW 2010

    As said altenbach, attach your event structures.  It should really be only need structure of an event, especially for a simple VI like that (I counted 3).  This is the second time I have recommended this today, but fetch JKI State Machine.  I use as the basis for most of my interfaces.

    Here's a way to manage the break with JKI.

  • In collaboration with a no engine in the types of different scheme (local variables).

    The program below is used to control a motor with the NI 9401. However, it has been designed to work in two ways, when you push the buttom "adelante" or "ago" he turns in one direction or another, but if you press 'Start' it begin to move in a particular way (which I mentioned) and if you press again the same ('Start'), we need to stop (this way you can push the door "adelante" or "ago" If you want to). The problem I have is with the "local variables", because when the 'Start' button is the I three while loop and I Don t know how said it stops when the 'Start' button has been pushed and the same when the 'Start' button is pushed, and I press the 'Start' button to stop it. I have a mess with the function of local variables.

    I know it's a little complicated to understand by Word, I tried to explain more clearly.  I hope you can help me.

    Hello matt198717,

    Yes, I think that the problem was trying to use local variables in parallel loops. I use this property at the time of the node and it works!.

  • Simulation & Control with local variables

    Why should I use a local variable in a loop of simulation, but not in a Subvi simulation?

    Local variables will only work in a Subvi are those that relate to controls or indicators located in the Sub - VI.  If you need to pass data between different from the Subvi, so you have several choices.

    1. common variables, as you said.

    2. global variables, as you said.

    3. pass the data in or out through the pane of the connector of the Subvi.

    4. functional Motors Global Variables/Action.

    5 lines of

    6. the references to the controls in the VI main so that they be used with nodes of property in the Sub - VI

  • update with local variables

    Hello

    I'm sure that this should be easy for the LV user, but I still get angry with the case.

    In the circle 1 Gauge_error has the value true, but when it happens in the circle 2, it is set to false (which is the default).

    I don't understand why because between the circles is true, as it should.

    I know I did something wrong with this local variable. I tried with the property node: value but the problem is still there.

    Thanks for your help.

    It's a classic race condition and is precisely why you should not use inhabitants. You assume that the second room is read after the first local in. Absolutely not true.

    Really, really work to replace the premises with a wire.

  • How to find the steps associated with a local variable?

    In a sequence, we have to write or read from a local variable. Is it possible (for example right-click the variable) to find out related measures?

    Thank you!

    Are you talking about discover what steps use the local variable.  Because the measures are not really "related" variables.  Either they are or they aren't.

    You can use the search/replace tool.  Edit > find/replace

    In the look for:, enter inhabitants.

    You can check her search for: box, and then select the order in which you want to search.  This should show you a list of all instances of the local variable.

    Hope this helps,

  • Changing variables with EventListener

    I borrowed a code to give my scene snow fall effect, and I've added power keys. I'm sure that there is another way around what I'm trying to do, but I'm curious to know to go on this path. contains the variable in the code:

    var snowflakesCnt:Number = 180;

    I added some EventListeners for buttons, but don' know the way on changing the variable to 0 and180 to the mouse click.

    To stop the snow, you must remove the snowflake clips, that you push to a table - so, I think that this could work:

    function snowOff(e:MouseEvent):void

    {

    snowflakesCnt = 0;

    {while (Snowflakes.Length)}

    var aFlake:MovieClip = snowflakes.splice (0.1) [0];

    removeChild (aFlake);

    }

    snowflakeProps = new Dictionary (true);

    }

    And then when you want, you must call init() again:

    function snowOn(e:MouseEvent):void

    {

    snowflakesCnt = 180;

    init();

    }

  • Cannot insert field or paste into the existing local Variable (Boolean container)

    Cannot insert field or paste into the existing local Variable (Boolean container)...  TestStand 4.1.

    It is very strange, especially since I've done it before.

    'Paste' and "insert field" selections are grayed out and disabled in the context menu.  I tried everything I could imagine and tried various combinations of positions.  I'm sure it's something simple, bu redicoulously, I can't find the redicule to solve this annoying problem issue.

    The local variable is a container of Boolean.  It has 90 elements and I need to add one more.  I can not change / rename or do something with this Local.  Must be karma (for those who know me in the LabVIEW forum).  Usually, you do a right click, insert field and that's where...  Not this one...

    Anyone seen this before?  Closing and re-opening TestStand doesn't change anything.  There is a collection in LabVIEW that feeds the local section in TestStand.

    It is a container of data custm type.  To change flags are ok (edit is allowed).  Can't think of any other valuable information...

    He finds...

    It should be edited in the Data Types...  It was not automatic after reloading the prototype of LabVIEW.

    I knew it was something stupid that I didn't...  I became close... but had not sought far enough.

    I was looking at the range of Types, but not in the file of the sequence...

Maybe you are looking for