private bool PushFormattedValue(ref DataGridViewCell dataGridViewCurrentCell, object formattedValue, out Exception exception) { Debug.Assert(this.IsCurrentCellInEditMode); exception = null; DataGridViewCellStyle cellStyle = this.InheritedEditingCellStyle; DataGridViewCellParsingEventArgs dgvcpe = OnCellParsing(this.ptCurrentCell.Y, this.ptCurrentCell.X, formattedValue, dataGridViewCurrentCell.ValueType, cellStyle); if (dgvcpe.ParsingApplied && dgvcpe.Value != null && dataGridViewCurrentCell.ValueType != null && dataGridViewCurrentCell.ValueType.IsAssignableFrom(dgvcpe.Value.GetType())) { if (dataGridViewCurrentCell.RowIndex == -1) { dataGridViewCurrentCell = this.Rows[this.ptCurrentCell.Y].Cells[this.ptCurrentCell.X]; // unsharing the row before pushing the new value } return dataGridViewCurrentCell.SetValueInternal(this.ptCurrentCell.Y, dgvcpe.Value); } object val; try { val = dataGridViewCurrentCell.ParseFormattedValue(formattedValue, dgvcpe.InheritedCellStyle, null, null); } catch (Exception e) { if (ClientUtils.IsCriticalException(e)) { throw; } exception = e; return false; } if (dataGridViewCurrentCell.RowIndex == -1) { dataGridViewCurrentCell = this.Rows[this.ptCurrentCell.Y].Cells[this.ptCurrentCell.X]; // unsharing the row before pushing the new value } return dataGridViewCurrentCell.SetValueInternal(this.ptCurrentCell.Y, val); }