C#: force TextBox to only Enter Number

Normally, Textbox Control would allow any text. If you want to restrict it to only enter numbers, you don’t need to use a MaskEdit, you need to simply add a handler for the event KeyPress on the TextBox, and set e.Handled to true only when it’s number that is being key in. private void txtAnswer_KeyPress(object […]