title: Casting string to textbox
body: <p>I am trying to access a Textbox in my form by casting a string equivalent to Textbox name in my form but i get error stating "Object reference not set to an instance of object"</p>
  
  <pre><code>private void writetotexboxarray()
  {
      // for (int i = 0; i &lt; 9; i++)
      //{
          //for (int j = 0; j &lt; 4; j++)
          //{
      textboxname= "Textbox" + 0 + 0;
      MessageBox.Show(textboxname);
      TextBox t = new TextBox();
  
      t = (TextBox)(this.Controls[textboxname]);
  
      //readintakedata[0,0].Text = t.Text;
      try
      {
          string value = t.Text;
      }
      catch (Exception exp)
      {
          MessageBox.Show(exp.Message);
      }
          // }
      // }
  }
  </code></pre>