private void myTextBoPreviewKeyDown(object sender, KeyEventArgs e) { switch(e.Key) { case Key.D0: case Key.D1: case Key.D2: case Key.D3: case Key.D4: case Key.D5: case Key.D6: case Key.D7: case Key.D8: case Key.D9: case Key.NumLock: case Key.NumPad0: case Key.NumPad1: case Key.NumPad2: case Key.NumPad3: case Key.NumPad4: case Key.NumPad5: case Key.NumPad6: case Key.NumPad7: case Key.NumPad8: case Key.NumPad9: case Key.Back: break; default: e.Handled = true; break; } }
Liked By
Write Answer
How to make a textbox which is only accept the numeric value in WPF
Join MindStick Community
You have need login or register for voting of answers or question.
shreesh chandra shukla
18-Jul-2013