//EVENT HANDLERS private void ButtonUpdateEntry_Click(object sender, EventArgs e) { try { var row = dataGridViewInventory.CurrentRow; if (row == null) { throw new Exception("Please select an entry to update"); } else { Service service = new Service() { ServiceId = (int)row.Cells[0].Value, ServiceName = (string)row.Cells[1].Value, ServicePrice = (decimal)row.Cells[2].Value, ProductId = (int)row.Cells[3].Value }; AddOrUpdateServiceForm updateServiceForm = new AddOrUpdateServiceForm(service); HandleForm(updateServiceForm); } } catch (Exception err) { MessageBox.Show(err.Message); } }
private void ButtonNewEntry_Click(object sender, EventArgs e) { AddOrUpdateServiceForm addServiceForm = new AddOrUpdateServiceForm(); HandleForm(addServiceForm); }