if ((e.KeyChar >= 48 && e.KeyChar <= 57) || e.KeyChar == 8 )
e.Handled = false;
else
e.Handled = true;
use ASCII Table for set that which key you want to be pressed and whichone not, this code can be used for enter only numeric data and allow the backspace .