Programming/Language
[DoNET] C# Text box 헥사 값만 입력 가능하게 설정
appHunter
2011. 10. 18. 20:11
TextBox 컨트롤에서
헥사 값만 (0 ~ F ) 입력되게 ..
1. 이벤트 KeyPress 추가
2. 코드 추가
private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if ("ABCDEF0123456789abcdef".IndexOf(e.KeyChar) == -1)
e.Handled = true;
}
헥사 값만 (0 ~ F ) 입력되게 ..
1. 이벤트 KeyPress 추가
2. 코드 추가
private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if ("ABCDEF0123456789abcdef".IndexOf(e.KeyChar) == -1)
e.Handled = true;
}