Access value of control that is created at run time
<p>I have a problem:</p>

<p>I create a TextBox at run time in a panel that is contained in a Wizard.</p>

<p>I want to access the value that the client will insert to this textbox.</p>

<p>I wrote this code to do that: </p>

<pre><code>TextBox _txt = Panel1.FindControl(txtArray[i].ID) as TextBox;
</code></pre>

<p>But I get this error:</p>

<blockquote>
  <p>Object reference not set to an instance of an object. </p>
</blockquote>

<p>That means that FindControl didn't find this control by its id.</p>

<p>This is the code for the creation of the textbox in runtime:    </p>

<pre><code>for (int i = 1; i &lt;= loop; i++)
{
     txtArray[i] = new TextBox();
     txtArray[i].ID = "txt4Name" + i;
}
</code></pre>

<p>Can someone help me to find the error?</p>
