프로그래밍/.Net

KeyPress 어떠한 Key가 눌러졌는지 알고싶다면....

강태공97 2014. 1. 17. 20:55

학습목표: 이번 장에서는 KeyPress를 활용하여,

특정 Key가 눌러졌을때 그에 상응하는 대응 코드를 작성해 보자.

 

//하기와 같이 KeyPress Event를 활용하면 된다.

끝..

 

private void txtboxScanData_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (int)Keys.Enter)
{
string sBuf = txtboxScanData.Text;
MessageBox.Show(sBuf);
}
}