private void txt_itemCode_KeyUp(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { DataTable dt = new DataTable(); DataTable stock = new DataTable(); string itemCode = txt_itemCode.Text; //get item data and fill data dt = MANAGEDB.getItemDataForStockEntry(itemCode); if (dt.Rows.Count >= 1) { txt_itemId.Text = dt.Rows[0]["itemId"].ToString(); txt_itemName.Text = dt.Rows[0]["itemName"].ToString(); txt_itemCode.Text = dt.Rows[0]["itemCode"].ToString(); //get stock entry for item stock = MANAGEDB.getStockEntryForItem(dt.Rows[0]["itemCode"].ToString()); if (stock.Rows.Count > 0) { txt_inStockQty.Text = MANAGEDB.getTotalStockAmountForItem(itemCode).ToString(); txt_stockIdQty.Text = stock.Rows[0]["remainQuantity"].ToString(); txt_UnitPrice.Text = stock.Rows[0]["sellingUnitPrice"].ToString(); txt_stockEntryId.Text = stock.Rows[0]["stockEntryId"].ToString(); //STOCK_ID_LIST.Add(txt_stockEntryId.Text); txt_releaseQty.Focus(); //System.Media.SystemSounds.Beep.Play(); //System.Media.SystemSounds.Asterisk.Play(); //System.Media.SystemSounds.Exclamation.Play(); //System.Media.SystemSounds.Question.Play(); //System.Media.SystemSounds.Hand.Play(); } else { COM_MESSAGE.warningMessage("There are no Remain Quantity for the item you entered", "No Items Remain"); } } else { txt_itemCode.Clear(); //System.Media.SystemSounds.Beep.Play(); //System.Media.SystemSounds.Asterisk.Play(); //System.Media.SystemSounds.Exclamation.Play(); //System.Media.SystemSounds.Question.Play(); //System.Media.SystemSounds.Hand.Play(); } } } catch (Exception ex) { COM_MESSAGE.exceptionMessage(ex.Message); } }