private void TxtOPID_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (TxtOPID.Text.Length == 8) { string sqlop = db.SwapData("", "QueryOPID", "OPID=" + TxtOPID.Text); if (sqlop.Contains("SF_CFG_CHK=PASS")) { TxtOPID.Enabled = false; TxtFixID.Enabled = true; TxtFixID.Focus(); Information.OPID = TxtOPID.Text; } else if (sqlop.Contains("SF_CFG_CHK")) { MessageBox.Show("工号不存在!"); TxtOPID.Clear(); } else { MessageBox.Show("无法验证OP!\r\n" + sqlop); TxtOPID.Enabled = false; TxtFixID.Enabled = true; TxtFixID.Focus(); Information.OPID = TxtOPID.Text; } } else { MessageBox.Show("工号长度错误:" + TxtOPID.Text); TxtOPID.Clear(); } } }
private void Login_Load(object sender, EventArgs e) { TxtOPID.Focus(); TxtFixID.Enabled = false; }