private void txtitemcode_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F5) { Clipboard.Clear(); Find_Products fr = new Find_Products(); fr.ShowDialog(); if (Clipboard.GetText() != null) { txtitemcode.Text = Clipboard.GetText(); } } }
private void Choose() { stockid = ""; Clipboard.Clear(); Find_Products fr = new Find_Products(); fr.ShowDialog(); if (Clipboard.GetText() != "") { stockid = Clipboard.GetText(); query = "select Inventory.ItemCode, ItemInformation.Description, Inventory.Cost, Inventory.SellPrice, Inventory.Alert, Inventory.Category, Inventory.ID from Inventory, ItemInformation where ItemInformation.ItemCode=Inventory.ItemCode and Inventory.ItemCode='" + stockid + "'"; tb = db.Search(query); if (tb.Rows.Count > 0) { stockid = tb.Rows[0][6].ToString(); txtitemcode.Text = tb.Rows[0][0].ToString(); txtdesciption.Text = tb.Rows[0][1].ToString(); txtalert.Text = tb.Rows[0][4].ToString(); txtcategory.Text = tb.Rows[0][5].ToString(); if (tb.Rows.Count > 1) { Clipboard.Clear(); Choose_Items cr = new Choose_Items(); cr.ItemCode = txtitemcode.Text; cr.ShowDialog(); if (Clipboard.GetText() != "") { query = "select Cost, SellPrice,ID from Inventory where ID='" + Clipboard.GetText() + "'"; tb = db.Search(query); if (tb.Rows.Count > 0) { stockid = tb.Rows[0][2].ToString(); txtcost.Text = tb.Rows[0][0].ToString(); txtsell.Text = tb.Rows[0][1].ToString(); } else { lblitem.Text = "--Click Here To Choose Item--"; stockid = ""; txtitemcode.Clear(); txtdesciption.Clear(); txtcategory.ResetText(); txtcost.Clear(); txtalert.Clear(); txtsell.Clear(); lblitem.Focus(); } } else { lblitem.Text = "--Click Here To Choose Item--"; stockid = ""; txtitemcode.Clear(); txtdesciption.Clear(); txtcategory.ResetText(); txtcost.Clear(); txtalert.Clear(); txtsell.Clear(); lblitem.Focus(); } } else { txtitemcode.Text = tb.Rows[0][0].ToString(); txtdesciption.Text = tb.Rows[0][1].ToString(); txtalert.Text = tb.Rows[0][4].ToString(); txtcategory.Text = tb.Rows[0][5].ToString(); txtcost.Text = tb.Rows[0][2].ToString(); txtsell.Text = tb.Rows[0][3].ToString(); } lblitem.Text = "SELECTED: " + txtitemcode.Text + " | " + txtdesciption.Text + " | " + txtsell.Text; } } else { lblitem.Text = "--Click Here To Choose Item--"; stockid = ""; txtitemcode.Clear(); txtdesciption.Clear(); txtcategory.ResetText(); txtcost.Clear(); txtalert.Clear(); txtsell.Clear(); lblitem.Focus(); } }