文本框只能输入数字

  private void txtSum_KeyPress(object sender, KeyPressEventArgs e)
        {
          

 if((e.KeyChar!=8 && !char.IsDigit(e.KeyChar)) && e.KeyChar != 13&&e.KeyChar!=46)
                {
                MessageBox.Show("商品数量只能输入数字", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                e.Handled = true;

            }


        }

posted on 2016-06-22 08:52  路上有你F  阅读(152)  评论(0编辑  收藏  举报