private void SaveButton_Click(object sender, EventArgs e) { int IntTest; Double DoubleTest; Boolean Fail = true; while (Fail) { _Product.Product_Name = Product_Name.Text; if (Int32.TryParse(Product_ID.Text, out IntTest)) { _Product.ProductId = Int32.Parse(Product_ID.Text); } else { MessageBox.Show("Not an acceptible ID"); Fail = false; break; } if (Int32.TryParse(Product_Stock.Text, out IntTest)) { _Product.Stock_Level = Int32.Parse(Product_Stock.Text); } else { MessageBox.Show("Not an acceptible stock level"); Fail = false; break; } if (Double.TryParse(Product_Price.Text, out DoubleTest)) { _Product.Price = Double.Parse(Product_Price.Text); } else { MessageBox.Show("Not an acceptible price"); Fail = false; break; } _PHPRepo.EditProductRecord(_Product); Product_ID.Clear(); Product_Name.Clear(); Product_Stock.Clear(); Product_Price.Clear(); Product_Name.Enabled = false; Product_Stock.Enabled = false; Product_Price.Enabled = false; StockList.Items.Clear(); List <Product> _NewList = _PHPRepo.GetProducts(); foreach (Product p in _NewList) { string[] row = { p.ProductId.ToString(), p.Product_Name.ToString(), p.Price.ToString(), p.Stock_Level.ToString() }; var listViewItem = new ListViewItem(row); StockList.Items.Add(listViewItem); } ; Fail = false; break; } }