Add this code to InitializeComponent() function:

this.TextBox.KeyPress += new
System.Windows.Forms.KeyPressEventHandler(this.TextBox_KeyPress);


and this to the code:
private void TextBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if ((e.KeyChar!=(char)8)&&(e.KeyChar!=(char)32)&&(!Char.IsDigit(e.KeyChar)) )
//the ASCII character code for SAPCE is 32 and BACKSAPCE is 8
{
e.Handled=true;
}
}

the above fn will allow only digits, space and backspace to be typed in the textbox.
Hope this helps.