//Click this to edit a package private void btnEditPackage_Click(object sender, EventArgs e) { try { var packageId = (int)dgvPackages.CurrentRow.Cells[0].Value; var package = _db.Packages.Where(p => p.PackageId == packageId).FirstOrDefault(); AddEditPackage frmAddpackage = new AddEditPackage(package, this); frmAddpackage.ShowDialog(); } catch (Exception ex) { MessageBox.Show($"Error: {ex.Message}"); } }
//Click this to Add a Package private void btnAddPackage_Click(object sender, EventArgs e) { AddEditPackage frmAddpackage = new AddEditPackage(managePackageListing: this); frmAddpackage.ShowDialog(); }