private void editCondition_Click(object sender, EventArgs e) { var selectedCell = ConditionsDataGridView.CurrentCell; if (selectedCell == null) { MessageBox.Show("No Row is selected, please try again."); return; } DataGridViewRow row = ConditionsDataGridView.Rows[ConditionsDataGridView.CurrentCell.RowIndex]; if (row.IsNewRow) { MessageBox.Show("No Condition is selected, please try again."); return; } var conditionSelected = (ConditionsMapperCondition)row.Tag; using (ConditionsMapper_EditCondition_Form editConditionDialog = new ConditionsMapper_EditCondition_Form(conditionSelected)) { if (editConditionDialog.ShowDialog((IWin32Window)this.ParentForm) != DialogResult.OK) { return; } this.UpdateConditionInGridview(editConditionDialog.TheCondition); } }
private void addCondition_Click(object sender, EventArgs e) { using (ConditionsMapper_EditCondition_Form newConditionDialog = new ConditionsMapper_EditCondition_Form()) { if (newConditionDialog.ShowDialog((IWin32Window)this.ParentForm) != DialogResult.OK) { return; } this.AddConditionToGridview(newConditionDialog.TheCondition); } }