文本框 只输入数字键和删除键

文本框 只输入数字键和删除键

private void txtLXDH_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = true;
            int input = Convert.ToInt32(e.KeyChar);
            if ((input <= 57 && input >= 48) || input == 8)
            {
                e.Handled = false;
            }
        }


posted @ 2012-12-27 11:09  五蕴非空  阅读(119)  评论(0编辑  收藏  举报
Fork me on GitHub