AsterixDisplayAnalyser.FormMain.textBoxUpdateRate_KeyPress C# (CSharp) Method

textBoxUpdateRate_KeyPress() private method

private textBoxUpdateRate_KeyPress ( object sender, KeyPressEventArgs e ) : void
sender object
e KeyPressEventArgs
return void
        private void textBoxUpdateRate_KeyPress(object sender, KeyPressEventArgs e)
        {
            string allowedCharacterSet = "0123456789\b";    	   //Allowed character set

            if (allowedCharacterSet.Contains(e.KeyChar.ToString()))
            {

            }
            else if (e.KeyChar.ToString() == "\r")
            {
                e.Handled = true;

                int UpdateRateinMS = Properties.Settings.Default.UpdateRate;
                if (int.TryParse(this.textBoxUpdateRate.Text, out UpdateRateinMS) == true)
                {
                    if (UpdateRateinMS > 0 && UpdateRateinMS < 100001)
                    {
                        Properties.Settings.Default.UpdateRate = UpdateRateinMS;
                        Properties.Settings.Default.Save();
                        this.PlotandTrackDisplayUpdateTimer.Interval = UpdateRateinMS;
                        this.labelDisplayUpdateRate.Text = "Update rate: " + this.PlotandTrackDisplayUpdateTimer.Interval.ToString() + "ms";
                        this.textBoxUpdateRate.Text = "";
                    }
                    else
                    {
                        MessageBox.Show("Please enter an integer in range of 1000 to 10000");
                    }
                }
                else
                {
                    MessageBox.Show("Please enter an integer in range of 1000 to 10000");
                }
            }
            else
            {
                MessageBox.Show("Please enter an integer in range of 1000 to 10000");
            }
        }
FormMain