private void btnAdd_Click(object sender, EventArgs e) { // Opens AddProductType form and ensures no record is currently selected GlobalVariables.selectedProductTypeID = 0; frmAddProductType editForm = new frmAddProductType(); editForm.ShowDialog(); lvProductTypes.Items.Clear(); DisplayProductTypes(); }
private void btnUpdate_Click(object sender, EventArgs e) { // Checks user has selected a product type if (lvProductTypes.SelectedItems.Count == 0) { MessageBox.Show("Please select a Product Type to update"); return; } // Stores ProductID to be updated GlobalVariables.selectedProductTypeID = int.Parse(lvProductTypes.SelectedItems[0].Text); // Opens AddProductType form frmAddProductType editForm = new frmAddProductType(); editForm.ShowDialog(); lvProductTypes.Items.Clear(); DisplayProductTypes(); }