只允许输入数字

//只允许输入数字
 private void SetKeyChar(KeyPressEventArgs e)
  {
    if (e.KeyChar == '-' || Char.IsDigit(e.KeyChar) == false)
      {
        if (e.KeyChar != '\b')
                {
                    e.Handled = true;
                }
          }
  }

 

 

posted @ 2014-03-10 11:10  汉城节度使  阅读(170)  评论(0编辑  收藏  举报