注意2个事件用的方式是不一样的

1.

private void txtSiteCode_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (this.txtSiteCode.Text.Trim() == "")
                {
                    this.txtSiteCode.Focus();
                }
            }
        }

2.

private void txtBarcodeCode_KeyPress(object sender, KeyPressEventArgs e)
        {
            //回车事件
            if (e.KeyChar == 13)
            {
                this.InsertTxt();
            }
        }

 

posted on 2014-06-23 17:10  清风暮雨  阅读(156)  评论(0)    收藏  举报