Tuesday 22 July 2014

Compact Framework Numeric Text Box

Dear All

A simple numeric text box  just add a simple text box after that create the On Key Press Event
then but the code below

 private void txtQty_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (Char.IsDigit(e.KeyChar) || Char.IsControl(e.KeyChar) || (e.KeyChar == '\b'))
            {
                e.Handled = false;
            }
            else
            {
                e.Handled = true;
            }
        }

Thanks and Regards
Hesham Hosni