private void btnAdd_Click(object sender, EventArgs e) { // Opens AddCustomer form and ensures no record is currently selected GlobalVariables.selectedCustomerID = 0; frmAddCustomer editForm = new frmAddCustomer(); editForm.ShowDialog(); lvCustomers.Items.Clear(); DisplayCustomers(); }
private void btnUpdate_Click(object sender, EventArgs e) { // Checks user has selected a customer if (lvCustomers.SelectedItems.Count == 0) { MessageBox.Show("Please select a Customer to update."); return; } // Stores CustomerID to be updated GlobalVariables.selectedCustomerID = int.Parse(lvCustomers.SelectedItems[0].Text); // Opens AddCustomer form frmAddCustomer editForm = new frmAddCustomer(); editForm.ShowDialog(); lvCustomers.Items.Clear(); DisplayCustomers(); }