title: How do I generate a textbox that only accepts numbers?
body: <p>Generate textboxes with:</p>
  
  <pre><code> public void addTextBox(int number)
      {
          for (int i = 0; i &lt; number; i++)
          {
              string name = "tb_" + (i + 1).ToString("00");
              tb = new TextBox();
              tb.Name = name;
              tb.Location = new Point(x, y);
              tb.Width = 20;
              x += 30;
  
              this.Controls.Add(tb);  
          }
      }
  </code></pre>
  
  <p>Manual formed textbox that only accepts numbers:</p>
  
  <pre><code> private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
      {
          const char Delete = (char)8;
          e.Handled = !Char.IsDigit(e.KeyChar) &amp;&amp; e.KeyChar != Delete;
      }
  </code></pre>
  
  <p>My questions: <strong>1.</strong> How do i set to generate texboxes that accepts only numbers?
  <strong>2.</strong> i would like to have only two numbers (from 0 - 99  <code>string pattern = @"^[0-9]{2}?$";</code>). Or is any different way to do this.</p>