private void dgv_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { DataGridView dgv = (DataGridView)sender; // Return if its not in one of the data/file columns OR if this is the first time column is being populated if (e.ColumnIndex < 1 || dgv.Columns[e.ColumnIndex].Tag == null) { return; } PerformanceFile ctfFile = (PerformanceFile)dgv.Columns[e.ColumnIndex].Tag; // Cancel and Return if the entry is not used if (!ctfFile.entry.ContainsKey(e.RowIndex)) { e.Cancel = true; return; } // Bring out special editor for FloatList values if (dgv.Rows[e.RowIndex].Cells[e.ColumnIndex].ValueType == typeof(FloatList)) { using (DGVListEditor editor = new DGVListEditor((CtfEditorGamePage)mainTabControl.SelectedTab.Tag, e.RowIndex)) { editor.ShowDialog(); } e.Cancel = true; } }