Hi Priyanka
I have created one small function for you,its completely different approch,there more then one way with which you can achieve this,i have developed one function which is as follows,just let me know,it is something which you want,just create KeyPress event of your textbox like following
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
int[] numArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
char bckSpace = '\b';
int isInt = 0;
bool blnIsInt = int.TryParse(e.KeyChar.ToString(), out isInt);
e.Handled = (isInt != 0 || e.KeyChar == '\b') ? false : true;
}
i think code is self explanatory,if you have any doubt just let me know
THANKS