private void btnDelete_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(stockID)) { throw new Exception("Select a record to perfrom operation"); } if (MessageBox.Show("Are you sure you want to delete ?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { setSales.DeleteStock(stockID); setSales.DisplayStock(dataGridItmes); ItemSales.StockNames(combStockName); stockID = ""; MessageBox.Show("Delete Successful", "Delete"); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public SalesStock() { InitializeComponent(); setSales.DisplayStock(dataGridItmes); ItemSales.StockNames(combStockName); }