<p>I'm creating some text boxes on my form programmatically which I need to reference later using FindControl.</p>

<p>I've put the FindControl instruction in the page load method after the code which creates them but get an error:</p>

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

<p>I assume this is because the textbox controls are not created until later in the lifecycle and therefore cannot be referenced from within Page_Load. </p>

<p>Can someone advise where in my code-behind I would need to place the FindControl instruction so that it can find these programmatically created text boxes?</p>

If you create textboxes programmatically you can use directly that to manipulate them. No need for FindControl (which would also be slower)
```
```
TextBox txt = new TextBox();
...
txt.Text = "Text";
```
```
If you need access in different methods you can just make txt a private variable of the class.
If you really need to use FindControl - are the textboxes added in the page (added to the Controls list of the page) when you call the function?