private void dgvCompoundTreatments_SelectionChanged(object sender, EventArgs e) { // For some reason this event fires twice when we load hte form, so I just put in a counter to stop unecessary database transactions from occuring. if (_skipLoadSelection < 2) { _skipLoadSelection++; } else { SaveCurrentCompoundTreatmentChanges(); } if (dgvCompoundTreatments.SelectedRows.Count == 1) { // Load up the elements, if they select more than one Compound Treatment at a time, call them a loser and select the first. if (dgvCompoundTreatments.SelectedRows[0].Cells["colCompoundTreatments"].Value != null) { _compoundTreatment = (CompoundTreatment)dgvCompoundTreatments.SelectedRows[0].Cells["colCompoundTreatments"].Value; LoadCompoundTreatmentElementsGrid(); } else { _compoundTreatment = null; dataGridViewCompoundTreatmentElements.Rows.Clear(); } } }
public FormCompoundTreatment(CompoundTreatment selectedCompoundTreatment, string effectedTreatmentAttribute) { // Load the compound treatment InitializeComponent(); _compoundTreatment = selectedCompoundTreatment; LoadCompoundTreatments(); LoadCompoundTreatmentElementsGrid(); _effectedTreatmentAttribute = effectedTreatmentAttribute; }