# Set a text property of TpsLabel

**URL:** <https://tech-community.robotics.abb.com/t/set-a-text-property-of-tpslabel/3597>\
**Category:** Developer Tools\
**Created:** [May 21, 2010, 6:14pm UTC](https://tech-community.robotics.abb.com/t/set-a-text-property-of-tpslabel/3597 "2010-05-21T18:14:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![granale](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/granale/32/2971_2.png) [@granale](https://tech-community.robotics.abb.com/u/granale)\
**Post date:** [May 21, 2010, 6:14pm UTC](https://tech-community.robotics.abb.com/t/set-a-text-property-of-tpslabel/3597/1 "2010-05-21T18:14:11Z")

</div>

Hello,

I want set the text property of a TpsLabel component. It works on virtual controler very well, but on real controler not. I use RW5.13.0225. See following lines.

\_Test.SetValue(“3”, true);

this.lMode.Text = “Grundstellungsfahrt”;

\_Test.SetValue(“31”, true);

In real controler the variable \_Test is 3. I get also no exception.  
Please, help.

granale

---

<div class="post-metadata">

**Author:** ![bidipow](https://avatars.discourse-cdn.com/v4/letter/b/e8c25b/32.png) [@bidipow](https://tech-community.robotics.abb.com/u/bidipow)\
**Post date:** [May 21, 2010, 8:07pm UTC](https://tech-community.robotics.abb.com/t/set-a-text-property-of-tpslabel/3597/2 "2010-05-21T20:07:59Z")

</div>

The variable must be declare in the controler as **PERS.**

---

<div class="post-metadata">

**Author:** ![granale](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/granale/32/2971_2.png) [@granale](https://tech-community.robotics.abb.com/u/granale)\
**Post date:** [May 22, 2010, 10:57pm UTC](https://tech-community.robotics.abb.com/t/set-a-text-property-of-tpslabel/3597/3 "2010-05-22T22:57:52Z")

</div>

…yes I know. That is not the problem. My problem is, the 3rd line in my example is never called. But only on real controller!!!

granale

---

<div class="post-metadata">

**Author:** ![carlosmtz2000](https://avatars.discourse-cdn.com/v4/letter/c/e79b87/32.png) [@carlosmtz2000](https://tech-community.robotics.abb.com/u/carlosmtz2000)\
**Post date:** [May 24, 2010, 4:37pm UTC](https://tech-community.robotics.abb.com/t/set-a-text-property-of-tpslabel/3597/4 "2010-05-24T16:37:25Z")

</div>

Hi,

Is this code running in the UI thread?

---

<div class="post-metadata">

**Author:** ![granale](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/granale/32/2971_2.png) [@granale](https://tech-community.robotics.abb.com/u/granale)\
**Post date:** [May 25, 2010, 11:58am UTC](https://tech-community.robotics.abb.com/t/set-a-text-property-of-tpslabel/3597/5 "2010-05-25T11:58:06Z")

</div>

…no, it isn’t. Is in a subform. But the controller is in UI-Thread. Also the Variable-Object for the change event.

granale

---

<div class="post-metadata">

**Author:** ![carlosmtz2000](https://avatars.discourse-cdn.com/v4/letter/c/e79b87/32.png) [@carlosmtz2000](https://tech-community.robotics.abb.com/u/carlosmtz2000)\
**Post date:** [May 25, 2010, 4:08pm UTC](https://tech-community.robotics.abb.com/t/set-a-text-property-of-tpslabel/3597/6 "2010-05-25T16:08:52Z")

</div>

The UI can be modified only by code running on a UI thread. Even if the controller was created in the UI thread, all its events are executed in a non-ui thread. If you would want to make a change in the UI, make sure to invoke the UI thread …

Sample Pseudo-code ..

// Assumming this code runs inside a TpsForm

void MyNoUIThread (…)  
{  
this.Invoke(new EventHandler(this.MyUIThread ), this, EventArgs.Empty));  
}

void MyUIThread (…)  
{  
// Change of the UI  
}

---

<div class="post-metadata">

**Author:** ![granale](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/granale/32/2971_2.png) [@granale](https://tech-community.robotics.abb.com/u/granale)\
**Post date:** [May 25, 2010, 5:47pm UTC](https://tech-community.robotics.abb.com/t/set-a-text-property-of-tpslabel/3597/7 "2010-05-25T17:47:52Z")

</div>

Thank you!

granale
