private void textBox_KeyPress(object sender, KeyPressEventArgs e)
{
// 숫자와 백스페이스와 '.' 키를 제외한 나머지를 바로 처리
if (!(char.IsDigit(e.KeyChar) || e.KeyChar == Convert.ToChar(Keys.Back) || e.KeyChar == 46))
{
e.Handled = true;
}
}
출처: https://louiey.tistory.com/entry/Textbox에-숫자만-입력받기 [Louie Work]
'Sduty > C#' 카테고리의 다른 글
MSSQL 백업&Restore(Source 포함) (0) | 2020.02.22 |
---|---|
DataGrid control III(Excel로 변환) (0) | 2020.02.22 |
DataGridView control II (0) | 2020.02.22 |
DataGridView control I (0) | 2020.02.22 |
문자열 split(ASP.NET 에도 해당됨) (0) | 2018.05.04 |