숫자만 입력
-
C# 텍스트박스에 숫자만 입력되게 하기닷넷/WinForms 2018. 6. 7. 17:25
텍스트박스에서 키를 눌렀을 때 숫자만 입력되게 하는 방법. private void txtBox1_KeyPress(object sender, KeyPressEventArgs e){ //숫자만 입력되도록 필터링 if(!(char.IsDigit(e.KeyChar) || e.KeyChar == Convert.ToChar(Keys.Back))) //숫자와 백스페이스를 제외한 나머지를 바로 처리 { e.Handled = true; }} 출처: http://terrorjang.tistory.com/39 [개발자 공간]