private void button3_Click(object sender, EventArgs e) { if (!int.TryParse(Product_Quantity.Text, out int x) || x == 0) { MessageBox.Show("Please Enter a number that is bigger than zero ", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (x > ActiveItem.Quantity) { MessageBox.Show("Quantity bigger than stock", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } CommBase.ExecuteNoReturn("UPDATE Product SET quantity = quantity - " + x.ToString() + " WHERE name = '" + ActiveItem.name + "';"); ActiveItem.Quantity = ActiveItem.Quantity - x; Transmitter.PlaceOrders(User.ActiveUser, ActiveItem); SuspendLayout(); CleanUp(); ListItems(Receiver.ReadFromProduct("SELECT * FROM Product;")); ResumeLayout(); show_home(); }