private void txtSearch_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return) { DataTable dt; dt = Util.DBQuery(string.Format(@"SELECT Barcode FROM Barcode WHERE Barcode = '" + txtSearch.Text.Trim() + "'")); if (dt.Rows.Count > 0) { barcode = dt.Rows[0]["Barcode"].ToString(); FmBarcode frm = new FmBarcode(); frm.Show(); txtSearch.Text = ""; } else { SearchData(); } } }