private void txtBarCode_Leave(object sender, EventArgs e) { if (this.txtBarCode.Text.Trim().Length > 0) { if (objBookManager.BarCodeExistsed(this.txtBarCode.Text.Trim())) { MessageBox.Show("this book exists in database"); this.txtBarCode.SelectAll(); this.txtBarCode.Focus(); } } }