private void _printersView_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (!_isUpdating) { var key = (KeyValuePair <PaperFormat, PaperType>)_printersView.Rows[e.RowIndex].Tag; string newPrinter = (string)_printersView["PrinterColumn", e.RowIndex].Value; if (PriceManager.ContainsProduct(GetProductKey(key))) { if (string.IsNullOrEmpty(newPrinter)) { PriceManager.RemoveProduct(GetProductKey(key)); } else { PriceManager.GetProduct(GetProductKey(key)).Printer = newPrinter; } } else if (!string.IsNullOrEmpty(newPrinter)) { PriceManager.AddProduct(key.Key, key.Value, newPrinter); } if (Parent is MainForm) { (Parent as MainForm).UpdatePriceNodes(); } } }