Example #1
0
        private void activationTimeBox_TextChanged(object sender, EventArgs e)
        {
            TextBox tb = sender as TextBox;

            if (tb.TextLength > 0)
            {
                if (!digits.Contains(tb.Text[tb.TextLength - 1]))
                {
                    string tmp = tb.Text.Substring(0, tb.Text.Length - 1);
                    tb.Text = "";
                    tb.AppendText(tmp);
                }
            }

            if (tb.TextLength > 3)
            {
                string tmp = tb.Text.Substring(0, 3);
                tb.Text = "";
                tb.AppendText(tmp);
            }
        }