텍스트 상자의 KeyUp 이벤트에서 Enter 키를 누른 후 Enter 키를 제거하십시오.
문제
리턴 키를 누른 후 텍스트 상자에서 Keypress 이벤트를 취소하는 방법.
해결책
keypresseventArgs 핸들러 매개 변수의 처리 된 속성을 true로 설정하십시오.
MSDN의 예 :
private void keypressed(Object o, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Return)
{
e.Handled = true;
}
}
보다 http://msdn.microsoft.com/en-us/library/system.windows.forms.keypresseventargs.handled.aspx 더 많은 정보를 위해서.
다른 팁
Enter 키를 무시하고 싶습니까?
키 다운 이벤트를 추가하고 Enter 키를 무시할 수 있습니다 ...
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
e.SuppressKeyPress = true;
}
}
제휴하지 않습니다 StackOverflow