private void RemoveButton_Click(object sender, EventArgs e) { int id; if (int.TryParse(SaleID.Text, out id)) { if (_pHPRepo.GetSaleById(id) != null) { sale = _pHPRepo.GetSaleById(id); _pHPRepo.RemoveSales(sale); MessageBox.Show("Sucessful", "Sale has been deleted", MessageBoxButtons.OK, MessageBoxIcon.None); SaleID.Clear(); } else { MessageBox.Show("Could not find Sale: " + SaleID.Text); } } else { MessageBox.Show("Please enter valid ID"); } }