private void addResidueButton_Click(object sender, EventArgs e) { EditChemicalResidueForm new_chemical = new EditChemicalResidueForm(null); new_chemical.ShowDialog(); addResidueDataToTable(new_chemical.createdAgent); }
private void editResidueButton_Click(object sender, EventArgs e) { if (chemicalResidueData.SelectedRows.Count > 0) { DataGridViewRow row = chemicalResidueData.SelectedRows[0]; ChemicalResidue agent = new ChemicalResidue(); agent.name = row.Cells[0].Value.ToString(); agent.physicalState = row.Cells[1].Value.ToString(); agent.origin = row.Cells[2].Value.ToString(); agent.quantity = (float)row.Cells[3].Value; agent.measurementUnit = row.Cells[4].Value.ToString(); agent.dangerous = (bool)row.Cells[5].Value; agent.dangerCharacteristics = row.Cells[6].Value.ToString(); agent.inert = (bool)row.Cells[7].Value; agent.storageDetails = row.Cells[8].Value.ToString(); agent.container = row.Cells[9].Value.ToString(); EditChemicalResidueForm editResidueForm = new EditChemicalResidueForm(agent); editResidueForm.ShowDialog(); if (editResidueForm.createdAgent != null) { chemicalResidueData.Rows[row.Index].Cells[0].Value = editResidueForm.createdAgent.name; chemicalResidueData.Rows[row.Index].Cells[1].Value = editResidueForm.createdAgent.physicalState; chemicalResidueData.Rows[row.Index].Cells[2].Value = editResidueForm.createdAgent.origin; // chemicalResidueData.Rows[row.Index].Cells[3].Value = editResidueForm.createdAgent.quantity; chemicalResidueData.Rows[row.Index].Cells[4].Value = editResidueForm.createdAgent.measurementUnit; chemicalResidueData.Rows[row.Index].Cells[5].Value = editResidueForm.createdAgent.dangerous; chemicalResidueData.Rows[row.Index].Cells[6].Value = editResidueForm.createdAgent.dangerCharacteristics; // chemicalResidueData.Rows[row.Index].Cells[7].Value = editResidueForm.createdAgent.inert; chemicalResidueData.Rows[row.Index].Cells[8].Value = editResidueForm.createdAgent.storageDetails; chemicalResidueData.Rows[row.Index].Cells[9].Value = editResidueForm.createdAgent.container; } } }