Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27017,11 +27017,10 @@ protected virtual bool SetCurrentCellAddressCore(int columnIndex,
int oldCurrentCellY = _ptCurrentCell.Y;
if (oldCurrentCellX >= 0
&& !_dataGridViewState1[State1_TemporarilyResetCurrentCell]
&& !_dataGridViewOper[OperationInDispose]
&& !_dataGridViewOper[OperationInReleasingDataSource])
&& !_dataGridViewOper[OperationInDispose])
{
DataGridViewCell currentCell = CurrentCellInternal;
if (!EndEdit(
if (IsHandleCreated && !EndEdit(
DataGridViewDataErrorContexts.Parsing | DataGridViewDataErrorContexts.Commit | DataGridViewDataErrorContexts.CurrentCellChange,
validateCurrentCell ? DataGridViewValidateCellInternal.Always : DataGridViewValidateCellInternal.Never,
fireCellLeave: validateCurrentCell,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ public partial class DataGridView : Control, ISupportInitialize
private const int OperationInEndEdit = 0x00400000;
private const int OperationResizingOperationAboutToStart = 0x00800000;
private const int OperationTrackKeyboardColResize = 0x01000000;
private const int OperationInReleasingDataSource = 0x02000000;
private const int OperationMouseOperationMask = OperationTrackColResize | OperationTrackRowResize |
OperationTrackColRelocation | OperationTrackColHeadersResize | OperationTrackRowHeadersResize;
private const int OperationKeyboardOperationMask = OperationTrackKeyboardColResize;
Expand Down Expand Up @@ -1922,16 +1921,7 @@ public object? DataSource
newDataSource.Disposed += OnDataSourceDisposed;
}

_dataGridViewOper[OperationInReleasingDataSource] = true;

try
{
CurrentCell = null;
}
finally
{
_dataGridViewOper[OperationInReleasingDataSource] = false;
}
CurrentCell = null;

if (DataConnection is null)
{
Expand Down