private void edtPhase_KeyDown(object sender, KeyEventArgs e)
{
//--- Suppress if a numeric key was not pressed ---//
if (e.KeyCode < Keys.D0 && e.KeyCode > Keys.D9)
{
//--- Suppress if a numeric pad key was no pressed ---//
if (e.KeyCode < Keys.NumPad0 || e.KeyCode > Keys.NumPad9)
{
//--- Suppress if the backspace was no pressed pressed ---//
if (e.KeyCode != Keys.Back)
{
// A non-numerical keystroke was pressed.
// Set the flag to true and evaluate in KeyPress event.
e.SuppressKeyPress = true;
}
}
}
//--- Suppress if the shift key was being pressed as well ---//
if (ModifierKeys == Keys.Shift)
{
e.SuppressKeyPress = true;
}
}