I am attempting to create dynamic controls determined by database fields, when the controls actually come up they throw a null reference error.

The error is thrown at the very last line of code in this segment. I can see the array is instantiated as type textbox, but the [0] position (along with all subsequent) within are null. What am I missing?

```
  var query = from a in com.Communications 
                    where a.fddkey == res.FDDKey
                    select a;
        var querydd = from b in com.Communications
                      select b.subject;

        int maxrows = query.Count();
        TextBox[] notestb = new TextBox[maxrows * 2];
        DropDownList[] notesdd = new DropDownList[maxrows];
        int i = 0;
        foreach (var s in query)
        {
            TableRow tr = new TableRow();
            tr.Cells.Add(new TableCell());
            tr.Cells.Add(new TableCell());
            tr.Cells[0].Text = "Date:";
            tr.Cells[1].Text = "Correspondent:";
            this.tblnotes.Rows.Add(tr);

            TableRow tr2 = new TableRow(); // Not sure if new row needs to  be instantiated or not.
            tr2.Cells.Add(new TableCell());
            tr2.Cells.Add(new TableCell());
            notestb[i].ID = "notestb" + i.ToString();

```