title: Update GUI from another thread in Visual C++ 2008
body: <p>I'm working on a program which requires me to update my windows form GUI from another thread(and not the main thread that created this GUI). I tried using:</p>
  
  <pre><code>rMainGUI-&gt;textBox3-&gt;Text = "TestDLL Try";
  rMainGUI-&gt;textBox3-&gt;Update();
  </code></pre>
  
  <p>But the program just got stuck at the first line.
  And if I remove the first line, it gives me an error during runtime, saying:</p>
  
  <p><code>"Cross-thread operation not valid: Control 'textBox3' accessed from a thread other than the thread it was created on."</code></p>
  
  <p>I want to know if there is some simple, threadsafe, UI updating function that I can use to update the GUI without messing up those threads? Or, if there is some command I can use to pause the current thread, go to main thread, update GUI and then go back to the current thread?</p>
  
  <p>Here are some screenshots:
  <a href="http://1.bp.blogspot.com/-g37cr0L2kbw/Ua5hD7eI6gI/AAAAAAAAANE/bI3n_kmyQKw/s1600/Screen+Shot+2013-06-04+at+3.04.35+PM.png%22Scr%201%22" rel="nofollow">Scr1</a>
  <a href="http://1.bp.blogspot.com/-_6BbAqcijSA/Ua5hDwmPM6I/AAAAAAAAANA/ha71jLH0PhY/s1600/Screen+Shot+2013-06-04+at+3.05.16+PM.png" rel="nofollow">Scr2</a>
  <a href="http://1.bp.blogspot.com/-fLtLmAZkdDQ/Ua5hD217oCI/AAAAAAAAANI/2rYZGbJ0Q9w/s1600/Screen+Shot+2013-06-04+at+5.09.15+PM.png" rel="nofollow">Scr3</a></p>
  
  <p>I have an average knowledge about C++, and a little knowledge about threads. 
  Any help would be much appreciated.</p>