9 writes to NewRowIndex
System.Windows.Forms (9)
System\Windows\Forms\Controls\DataGridView\DataGridView.DataConnection.cs (1)
439
_owner.
NewRowIndex
= -1;
System\Windows\Forms\Controls\DataGridView\DataGridView.Methods.cs (8)
74
NewRowIndex
= Rows.Count - 1;
5362
NewRowIndex
= -1; // No more 'new' row.
5366
NewRowIndex
--;
5388
NewRowIndex
+= insertionCount;
5472
NewRowIndex
= Rows.Count - 1;
10590
NewRowIndex
= rowIndex;
13227
NewRowIndex
= -1;
14586
NewRowIndex
= -1;
100 references to NewRowIndex
System.Windows.Forms (97)
System\Windows\Forms\Controls\DataGridView\DataGridView.DataConnection.cs (11)
412
if (!_dataConnectionState[DATACONNECTIONSTATE_finishedAddNew] && _owner.
NewRowIndex
== e.NewIndex)
596
if (_owner.
NewRowIndex
== -1 || e.NewIndex != _owner.Rows.Count)
719
CurrencyManager.Position == _owner.
NewRowIndex
&& // condition 4.
720
_owner.CurrentCellAddress.Y != _owner.
NewRowIndex
&& // condition 5.
766
Debug.Assert(_owner.
NewRowIndex
!= -1, "the NewRowIndex is -1 only when AllowUserToAddRows is false");
770
if (_owner.CurrentCellAddress.Y != _owner.
NewRowIndex
|| _owner.IsCurrentRowDirty)
829
if (_owner.
NewRowIndex
== CurrencyManager.List.Count)
832
deleteAddNewRow = (rowIndex == _owner.
NewRowIndex
- 1);
837
Debug.Assert(_owner.
NewRowIndex
== CurrencyManager.List.Count - 1);
838
deleteAddNewRow = (rowIndex == _owner.
NewRowIndex
);
1356
if (e.RowIndex != _owner.
NewRowIndex
System\Windows\Forms\Controls\DataGridView\DataGridView.Methods.cs (49)
71
Debug.Assert(
NewRowIndex
== -1);
79
DataGridViewRowEventArgs dgvRowEvent = new(Rows[
NewRowIndex
]);
89
NewRowIndex
+ (AppContextSwitches.DataGridViewUIAStartRowCountAtZero ? 0 : 1)));
3256
if (discardNewRow && _ptCurrentCell.Y ==
NewRowIndex
- 1)
3264
if (!IsCurrentRowDirty && _ptCurrentCell.Y ==
NewRowIndex
- 1 && _dataGridViewState1[State1_NewRowCreatedByEditing])
5360
if (
NewRowIndex
== rowIndexDeleted)
5364
else if (
NewRowIndex
!= -1)
5386
if (
NewRowIndex
!= -1)
5450
Debug.Assert(
NewRowIndex
!= -1);
5452
DataGridViewRowCancelEventArgs dgvrce = new(Rows[
NewRowIndex
]);
5460
Debug.Assert(
NewRowIndex
== Rows.Count - 1);
5461
DataGridViewRow dataGridViewRow = Rows[
NewRowIndex
];
5462
Rows.RemoveAtInternal(
NewRowIndex
, force: false);
5468
Debug.Assert(
NewRowIndex
== -1);
5473
Debug.Assert((Rows.GetRowState(
NewRowIndex
) & DataGridViewElementStates.Visible) != 0);
5474
Debug.Assert(_ptCurrentCell.Y ==
NewRowIndex
);
5476
OnDefaultValuesNeeded(new DataGridViewRowEventArgs(Rows[
NewRowIndex
]));
5477
InvalidateRowPrivate(
NewRowIndex
);
10585
if (AllowUserToAddRowsInternal &&
NewRowIndex
== -1)
10793
if (dataGridViewColumn.CellTemplate!.DefaultNewRowValue is not null &&
NewRowIndex
!= -1)
10797
_ = Rows[
NewRowIndex
];
10811
if (rowIndex ==
NewRowIndex
)
10938
if (dataGridViewColumn.CellTemplate!.DefaultNewRowValue is not null &&
NewRowIndex
!= -1)
10942
_ = Rows[
NewRowIndex
];
10963
if (rowIndex ==
NewRowIndex
)
14581
if (IsCurrentCellDirty &&
NewRowIndex
== _ptCurrentCell.Y)
15428
if (dataGridViewColumn.CellTemplate!.DefaultNewRowValue is not null &&
NewRowIndex
!= -1)
15432
_ = Rows[
NewRowIndex
];
15446
if (rowIndex ==
NewRowIndex
)
17260
Debug.Assert(
NewRowIndex
!= -1);
17261
Debug.Assert(
NewRowIndex
== Rows.Count - 1);
17662
if (!validationFailureOccurred && AllowUserToAddRowsInternal &&
NewRowIndex
== rowIndex)
17668
DataGridViewRowEventArgs dgvre = new(Rows[
NewRowIndex
]);
17689
InvalidateRowPrivate(
NewRowIndex
);
17694
Debug.Assert(
NewRowIndex
== -1, "newRowIndex and AllowUserToAddRowsInternal became out of sync");
18763
if (rowIndex ==
NewRowIndex
)
19080
if (DataSource is not null && _ptCurrentCell.X >= 0 && AllowUserToAddRowsInternal &&
NewRowIndex
== _ptCurrentCell.Y)
19767
if (
NewRowIndex
!= -1)
19769
DataGridViewRow newRow = Rows.SharedRow(
NewRowIndex
);
19775
newRow = Rows[
NewRowIndex
]; // un-share the 'new row'.
19783
dataGridViewCell.SetValueInternal(
NewRowIndex
, dataGridViewCell.DefaultNewRowValue);
19946
if (rowIndex ==
NewRowIndex
|| rowIndex >= Rows.Count)
19967
if (
NewRowIndex
< rowCount)
25325
if (Columns.Count > 0 &&
NewRowIndex
== -1)
25330
else if (
NewRowIndex
!= -1)
25333
Debug.Assert(
NewRowIndex
== Rows.Count - 1);
25334
Rows.RemoveAtInternal(
NewRowIndex
, force: false);
28342
Debug.Assert(rowIndex1 !=
NewRowIndex
);
28343
Debug.Assert(rowIndex2 !=
NewRowIndex
);
System\Windows\Forms\Controls\DataGridView\DataGridViewBand.cs (2)
689
DataGridView.
NewRowIndex
!= -1 &&
690
DataGridView.
NewRowIndex
== Index &&
System\Windows\Forms\Controls\DataGridView\DataGridViewButtonCell.cs (1)
427
DataGridView.
NewRowIndex
!= rowIndex &&
System\Windows\Forms\Controls\DataGridView\DataGridViewCell.cs (2)
1549
&& rowIndex != DataGridView.
NewRowIndex
2427
|| (dataGridView.AllowUserToAddRowsInternal && rowIndex > -1 && rowIndex == dataGridView.
NewRowIndex
&& rowIndex != dataGridView.CurrentCellAddress.Y)
System\Windows\Forms\Controls\DataGridView\DataGridViewImageCell.cs (1)
161
DataGridView.
NewRowIndex
== RowIndex &&
System\Windows\Forms\Controls\DataGridView\DataGridViewLinkCell.cs (1)
671
DataGridView.
NewRowIndex
!= rowIndex &&
System\Windows\Forms\Controls\DataGridView\DataGridViewRow.cs (3)
74
&& Index != DataGridView.
NewRowIndex
)
248
get => DataGridView is not null && DataGridView.
NewRowIndex
== Index;
1246
rowIndex != DataGridView.
NewRowIndex
)
System\Windows\Forms\Controls\DataGridView\DataGridViewRow.DataGridViewRowAccessibleObject.cs (1)
217
if (_owningDataGridViewRow.DataGridView is not null && _owningDataGridViewRow.DataGridView.AllowUserToAddRows && _owningDataGridViewRow.Index == _owningDataGridViewRow.DataGridView.
NewRowIndex
)
System\Windows\Forms\Controls\DataGridView\DataGridViewRowCollection.cs (18)
224
if (DataGridView.
NewRowIndex
!= -1)
227
Debug.Assert(DataGridView.
NewRowIndex
== Count - 1);
368
if (DataGridView.
NewRowIndex
!= -1)
371
Debug.Assert(DataGridView.
NewRowIndex
== Count - 1);
406
if (DataGridView.
NewRowIndex
!= -1)
409
Debug.Assert(DataGridView.
NewRowIndex
== Count - 1);
483
if (DataGridView.
NewRowIndex
!= -1)
486
Debug.Assert(DataGridView.
NewRowIndex
== Count - 1);
548
if (DataGridView.
NewRowIndex
!= -1)
551
Debug.Assert(DataGridView.
NewRowIndex
== Count - 1);
728
if (DataGridView.
NewRowIndex
!= -1)
731
Debug.Assert(DataGridView.
NewRowIndex
== Count - 1);
1422
if (DataGridView.
NewRowIndex
!= -1 && rowIndex == Count)
1467
if (DataGridView.
NewRowIndex
!= -1 && rowIndex == Count)
1499
Debug.Assert(DataGridView.
NewRowIndex
== -1 || rowIndex != Count);
1599
if (DataGridView.
NewRowIndex
!= -1 && indexDestination == Count)
1769
if (DataGridView.
NewRowIndex
!= -1 && rowIndex == Count)
2168
if (DataGridView.
NewRowIndex
== index)
System\Windows\Forms\Controls\DataGridView\DataGridViewRowCollection.RowComparer.cs (2)
41
if (_dataGridView.
NewRowIndex
!= -1)
44
if (rowIndex == _dataGridView.
NewRowIndex
)
System\Windows\Forms\Controls\DataGridView\DataGridViewRowHeaderCell.cs (6)
785
else if (DataGridView.
NewRowIndex
== rowIndex)
800
else if (DataGridView.
NewRowIndex
== rowIndex)
810
else if (DataGridView.
NewRowIndex
== rowIndex)
941
else if (DataGridView.
NewRowIndex
== rowIndex)
956
else if (DataGridView.
NewRowIndex
== rowIndex)
966
else if (DataGridView.
NewRowIndex
== rowIndex)
System.Windows.Forms.Tests (3)
System\Windows\Forms\DataGridViewLinkCellTests.cs (1)
384
int newRowIndex = dataGridView.
NewRowIndex
;
System\Windows\Forms\DataGridViewTests.cs (2)
4066
_dataGridView.CurrentCell = _dataGridView.Rows[_dataGridView.
NewRowIndex
].Cells[0];
4070
_dataGridView.CurrentCell = _dataGridView.Rows[_dataGridView.
NewRowIndex
].Cells[1];