title: Accessing GUI components through C++ code in VC++
body: <p>I have created a Windows Form Project in VC++ 2010 Express version. So, in that project I created a Form, which had only 1 button and 1 textbox. The name of this form was <code>Form1</code>.  </p>
  
  <p>This button called a function <code>FD</code> written in a <code>.cpp</code> file in the same project. However, while running the code, I need to update the textbox with some text. I want to access the textbox through the <code>.cpp</code> file.  </p>
  
  <p>I have tried the following:<br>
  I included <code>#include "Form1.h"</code> and then wrote <code>textBox1-&gt;Text="XYZ"</code>. However, while building it says that it cannot find any member called <code>textBox1</code>.  </p>
  
  <p>How do I access the textbox from the <code>.cpp</code> file?  </p>
  
  <p>EDIT:<br>
  <code>FD.cpp</code>  </p>
  
  <pre><code>#include&lt;stdafx.h&gt;
  #include "Form1.h" 
  ... //other includes  
  
  void abc()
  {
      //Some code
      textBox1-&gt;Text="String to be displayed."
      //Some code
  }
  </code></pre>
  
  <p><code>Form1.h</code><br>
  This is simple GUI form, where a button called <code>button1</code> and a textbox called <code>textBox1</code> is added.  </p>
  
  <pre><code>#include&lt;FD.h&gt;
  //code generated by the GUI
  void button1_click()
  {
      abc();
  }
  </code></pre>