If you are doing this in a Windows Form based application, make use of
MaskedTextBox
. If this is web based application, you can make use of
MaskedEdit
control that comes with Ajax toolkit.
Edit: Since you are using Windows form, this is a better way to do it:
NumericUpDown numericUpDown = new NumericUpDown();
numericUpDown.Maximum = 99.9M;
numericUpDown.Minimum = 0.0M;
numericUpDown.DecimalPlaces = 1;
Edit 1: There no NumericUpDown in WPF. You can get one from Extended WPF toolkit or build your own.