Public void keypressnum (KeyPressEventArgs E)
{
IF (! char.isnumber (e.Keychar) && E.Keychar! = (char) 8 && E.Keychar! = (char) 46)
e.handled = true;
}
Then call this function in the TextBox Click on the event.