Example #1
0
        //-------------------------------------------------------------
        //
        //	eventRepeatCountTextBox_Validating()
        //
        //		validate our eventReportCountTextBox
        //
        //-------------------------------------------------------------

        private void eventRepeatCountTextBox_Validating(object sender, CancelEventArgs e)
        {
            int count;

            if (!Int32.TryParse(((TextBox)sender).Text, out count))
            {
                count = 0;
            }
            if (count < 0 || 99 < count)
            {
                e.Cancel = true;
            }
            if (e.Cancel)
            {
                MessageBeepClass.MessageBeep(MessageBeepClass.BeepType.SimpleBeep);
            }
        }
Example #2
0
        //-------------------------------------------------------------
        //
        //	NumTextBox_KeyPress() - event handler for a numeric textbox
        //
        //		this handler is used by the univDVGN editing control
        //		for the numeric columns and by a simple textbox control
        //		for numeric only input controls
        //
        //-------------------------------------------------------------

        private void NumTextBox_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = true;

            if (Char.IsControl(e.KeyChar))
            {
                e.Handled = false;
            }
            if (Char.IsDigit(e.KeyChar))
            {
                e.Handled = false;
            }

            if (e.Handled)
            {
                MessageBeepClass.MessageBeep(MessageBeepClass.BeepType.SimpleBeep);
            }
        }
Example #3
0
        private void eventSuppressCountTextBoxValidating(object sender, CancelEventArgs e)
        {
            int count;

            if (!int.TryParse(((TextBox)sender).Text, out count))
            {
                count = -1;
            }

            if (count < 0 || 10000 < count)
            {
                e.Cancel = true;
            }

            if (e.Cancel)
            {
                Focus();
                MessageBeepClass.MessageBeep(MessageBeepClass.BeepType.SimpleBeep);
            }
        }