Q:

How do I generate a textbox that only accepts numbers? 

Generate textboxes with:
 public void addTextBox(int number)
    {
        for (int i = 0; i < 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);  
        }
    }

Manual formed textbox that only accepts numbers:
 private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
    {
        const char Delete = (char)8;
        e.Handled = ! Char. IsDigit(e. KeyChar) && e.KeyChar ! = Delete;
    }

My questions: 1.  How do i set to generate texboxes that accepts only numbers? 
2.  i would like to have only two numbers (from 0 - 99  string pattern = @"^[0-9]{2}?$";).  Or is any different way to do this. 

A:

How about using NumericUpDown Class? ( This could be the easiest.)  You could setup the maximum and the minimum value.  You can also set it to INTEGER only. 
LINK HERE

A:

Use MaskedTextBox and set the Mask property to 00. 

A:

is the textBox1_KeyPress the method to handle the validation of the Texbox input?  
if so - just before adding the TextBox, add an event refference:
tb. KeyPress += new KeyPressEventHandler(textBox1_KeyPress);

UPD:
another option (this is the dirty way):
    tb. KeyPress += (sender, e)=>{ 
 const char Delete = (char)8;
        e.Handled = ! Char. IsDigit(e. KeyChar) && e.KeyChar ! = Delete;
    };

before the  this. Controls. Add(tb); 

