示例#1
0
 private void txtStockID_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyData == Keys.Tab || e.KeyCode == Keys.Down || e.KeyCode == Keys.Enter)
     {
         if (!_stockService.CheckStockIdExit(txtStockID.Text))
         {
             Ultils.SetColorErrorTextControl(txtStockID, string.Format("ID {0} này đã tồn tại!", txtStockID.Text));
         }
         else
         {
             Ultils.SetColorDefaultTextControl(txtStockID);
         }
         txtStockName.Focus();
     }
     else if (e.KeyCode == Keys.Escape)
     {
         txtStockID.Text = "";
     }
 }