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)
75
NewRowIndex
= Rows.Count - 1;
5520
NewRowIndex
= -1; // No more 'new' row.
5524
NewRowIndex
--;
5546
NewRowIndex
+= insertionCount;
5630
NewRowIndex
= Rows.Count - 1;
11014
NewRowIndex
= rowIndex;
13638
NewRowIndex
= -1;
14997
NewRowIndex
= -1;
99 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)
72
Debug.Assert(
NewRowIndex
== -1);
80
DataGridViewRowEventArgs dgvRowEvent = new(Rows[
NewRowIndex
]);
88
string.Format(SR.DataGridView_RowAddedNotification,
NewRowIndex
+ (LocalAppContextSwitches.DataGridViewUIAStartRowCountAtZero ? 0 : 1)));
3383
if (discardNewRow && _ptCurrentCell.Y ==
NewRowIndex
- 1)
3391
if (!IsCurrentRowDirty && _ptCurrentCell.Y ==
NewRowIndex
- 1 && _dataGridViewState1[State1_NewRowCreatedByEditing])
5518
if (
NewRowIndex
== rowIndexDeleted)
5522
else if (
NewRowIndex
!= -1)
5544
if (
NewRowIndex
!= -1)
5608
Debug.Assert(
NewRowIndex
!= -1);
5610
DataGridViewRowCancelEventArgs dgvrce = new(Rows[
NewRowIndex
]);
5618
Debug.Assert(
NewRowIndex
== Rows.Count - 1);
5619
DataGridViewRow dataGridViewRow = Rows[
NewRowIndex
];
5620
Rows.RemoveAtInternal(
NewRowIndex
, force: false);
5626
Debug.Assert(
NewRowIndex
== -1);
5631
Debug.Assert((Rows.GetRowState(
NewRowIndex
) & DataGridViewElementStates.Visible) != 0);
5632
Debug.Assert(_ptCurrentCell.Y ==
NewRowIndex
);
5634
OnDefaultValuesNeeded(new DataGridViewRowEventArgs(Rows[
NewRowIndex
]));
5635
InvalidateRowPrivate(
NewRowIndex
);
11009
if (AllowUserToAddRowsInternal &&
NewRowIndex
== -1)
11217
if (dataGridViewColumn.CellTemplate!.DefaultNewRowValue is not null &&
NewRowIndex
!= -1)
11220
DataGridViewRow newRow = Rows[
NewRowIndex
];
11234
if (rowIndex ==
NewRowIndex
)
11361
if (dataGridViewColumn.CellTemplate!.DefaultNewRowValue is not null &&
NewRowIndex
!= -1)
11364
DataGridViewRow newRow = Rows[
NewRowIndex
];
11385
if (rowIndex ==
NewRowIndex
)
14992
if (IsCurrentCellDirty &&
NewRowIndex
== _ptCurrentCell.Y)
15838
if (dataGridViewColumn.CellTemplate!.DefaultNewRowValue is not null &&
NewRowIndex
!= -1)
15841
DataGridViewRow newRow = Rows[
NewRowIndex
];
15855
if (rowIndex ==
NewRowIndex
)
17682
Debug.Assert(
NewRowIndex
!= -1);
17683
Debug.Assert(
NewRowIndex
== Rows.Count - 1);
18098
if (!validationFailureOccurred && AllowUserToAddRowsInternal &&
NewRowIndex
== rowIndex)
18104
DataGridViewRowEventArgs dgvre = new(Rows[
NewRowIndex
]);
18125
InvalidateRowPrivate(
NewRowIndex
);
18130
Debug.Assert(
NewRowIndex
== -1, "newRowIndex and AllowUserToAddRowsInternal became out of sync");
19199
if (rowIndex ==
NewRowIndex
)
19516
if (DataSource is not null && _ptCurrentCell.X >= 0 && AllowUserToAddRowsInternal &&
NewRowIndex
== _ptCurrentCell.Y)
20217
if (
NewRowIndex
!= -1)
20219
DataGridViewRow newRow = Rows.SharedRow(
NewRowIndex
);
20225
newRow = Rows[
NewRowIndex
]; // un-share the 'new row'.
20233
dataGridViewCell.SetValueInternal(
NewRowIndex
, dataGridViewCell.DefaultNewRowValue);
20396
if (rowIndex ==
NewRowIndex
|| rowIndex >= Rows.Count)
20417
if (
NewRowIndex
< rowCount)
25802
if (Columns.Count > 0 &&
NewRowIndex
== -1)
25807
else if (
NewRowIndex
!= -1)
25810
Debug.Assert(
NewRowIndex
== Rows.Count - 1);
25811
Rows.RemoveAtInternal(
NewRowIndex
, force: false);
28824
Debug.Assert(rowIndex1 !=
NewRowIndex
);
28825
Debug.Assert(rowIndex2 !=
NewRowIndex
);
System\Windows\Forms\Controls\DataGridView\DataGridViewBand.cs (2)
694
DataGridView.
NewRowIndex
!= -1 &&
695
DataGridView.
NewRowIndex
== Index &&
System\Windows\Forms\Controls\DataGridView\DataGridViewButtonCell.cs (1)
437
DataGridView.
NewRowIndex
!= rowIndex &&
System\Windows\Forms\Controls\DataGridView\DataGridViewCell.cs (2)
1565
rowIndex != DataGridView.
NewRowIndex
&&
2441
(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)
723
DataGridView.
NewRowIndex
!= rowIndex &&
System\Windows\Forms\Controls\DataGridView\DataGridViewRow.cs (3)
74
&& Index != DataGridView.
NewRowIndex
)
254
get => DataGridView is not null && DataGridView.
NewRowIndex
== Index;
1248
rowIndex != DataGridView.
NewRowIndex
)
System\Windows\Forms\Controls\DataGridView\DataGridViewRow.DataGridViewRowAccessibleObject.cs (1)
218
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)
781
else if (DataGridView.
NewRowIndex
== rowIndex)
796
else if (DataGridView.
NewRowIndex
== rowIndex)
806
else if (DataGridView.
NewRowIndex
== rowIndex)
937
else if (DataGridView.
NewRowIndex
== rowIndex)
952
else if (DataGridView.
NewRowIndex
== rowIndex)
962
else if (DataGridView.
NewRowIndex
== rowIndex)
System.Windows.Forms.Tests (2)
System\Windows\Forms\DataGridViewTests.cs (2)
4065
_dataGridView.CurrentCell = _dataGridView.Rows[_dataGridView.
NewRowIndex
].Cells[0];
4069
_dataGridView.CurrentCell = _dataGridView.Rows[_dataGridView.
NewRowIndex
].Cells[1];