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;
5365
NewRowIndex
= -1; // No more 'new' row.
5369
NewRowIndex
--;
5391
NewRowIndex
+= insertionCount;
5475
NewRowIndex
= Rows.Count - 1;
10593
NewRowIndex
= rowIndex;
13230
NewRowIndex
= -1;
14589
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)
71
Debug.Assert(
NewRowIndex
== -1);
79
DataGridViewRowEventArgs dgvRowEvent = new(Rows[
NewRowIndex
]);
89
NewRowIndex
+ (AppContextSwitches.DataGridViewUIAStartRowCountAtZero ? 0 : 1)));
3259
if (discardNewRow && _ptCurrentCell.Y ==
NewRowIndex
- 1)
3267
if (!IsCurrentRowDirty && _ptCurrentCell.Y ==
NewRowIndex
- 1 && _dataGridViewState1[State1_NewRowCreatedByEditing])
5363
if (
NewRowIndex
== rowIndexDeleted)
5367
else if (
NewRowIndex
!= -1)
5389
if (
NewRowIndex
!= -1)
5453
Debug.Assert(
NewRowIndex
!= -1);
5455
DataGridViewRowCancelEventArgs dgvrce = new(Rows[
NewRowIndex
]);
5463
Debug.Assert(
NewRowIndex
== Rows.Count - 1);
5464
DataGridViewRow dataGridViewRow = Rows[
NewRowIndex
];
5465
Rows.RemoveAtInternal(
NewRowIndex
, force: false);
5471
Debug.Assert(
NewRowIndex
== -1);
5476
Debug.Assert((Rows.GetRowState(
NewRowIndex
) & DataGridViewElementStates.Visible) != 0);
5477
Debug.Assert(_ptCurrentCell.Y ==
NewRowIndex
);
5479
OnDefaultValuesNeeded(new DataGridViewRowEventArgs(Rows[
NewRowIndex
]));
5480
InvalidateRowPrivate(
NewRowIndex
);
10588
if (AllowUserToAddRowsInternal &&
NewRowIndex
== -1)
10796
if (dataGridViewColumn.CellTemplate!.DefaultNewRowValue is not null &&
NewRowIndex
!= -1)
10800
_ = Rows[
NewRowIndex
];
10814
if (rowIndex ==
NewRowIndex
)
10941
if (dataGridViewColumn.CellTemplate!.DefaultNewRowValue is not null &&
NewRowIndex
!= -1)
10945
_ = Rows[
NewRowIndex
];
10966
if (rowIndex ==
NewRowIndex
)
14584
if (IsCurrentCellDirty &&
NewRowIndex
== _ptCurrentCell.Y)
15431
if (dataGridViewColumn.CellTemplate!.DefaultNewRowValue is not null &&
NewRowIndex
!= -1)
15435
_ = Rows[
NewRowIndex
];
15449
if (rowIndex ==
NewRowIndex
)
17266
Debug.Assert(
NewRowIndex
!= -1);
17267
Debug.Assert(
NewRowIndex
== Rows.Count - 1);
17668
if (!validationFailureOccurred && AllowUserToAddRowsInternal &&
NewRowIndex
== rowIndex)
17674
DataGridViewRowEventArgs dgvre = new(Rows[
NewRowIndex
]);
17695
InvalidateRowPrivate(
NewRowIndex
);
17700
Debug.Assert(
NewRowIndex
== -1, "newRowIndex and AllowUserToAddRowsInternal became out of sync");
18769
if (rowIndex ==
NewRowIndex
)
19086
if (DataSource is not null && _ptCurrentCell.X >= 0 && AllowUserToAddRowsInternal &&
NewRowIndex
== _ptCurrentCell.Y)
19776
if (
NewRowIndex
!= -1)
19778
DataGridViewRow newRow = Rows.SharedRow(
NewRowIndex
);
19784
newRow = Rows[
NewRowIndex
]; // un-share the 'new row'.
19792
dataGridViewCell.SetValueInternal(
NewRowIndex
, dataGridViewCell.DefaultNewRowValue);
19955
if (rowIndex ==
NewRowIndex
|| rowIndex >= Rows.Count)
19976
if (
NewRowIndex
< rowCount)
25334
if (Columns.Count > 0 &&
NewRowIndex
== -1)
25339
else if (
NewRowIndex
!= -1)
25342
Debug.Assert(
NewRowIndex
== Rows.Count - 1);
25343
Rows.RemoveAtInternal(
NewRowIndex
, force: false);
28350
Debug.Assert(rowIndex1 !=
NewRowIndex
);
28351
Debug.Assert(rowIndex2 !=
NewRowIndex
);
System\Windows\Forms\Controls\DataGridView\DataGridViewBand.cs (2)
695
DataGridView.
NewRowIndex
!= -1 &&
696
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 (2)
System\Windows\Forms\DataGridViewTests.cs (2)
4066
_dataGridView.CurrentCell = _dataGridView.Rows[_dataGridView.
NewRowIndex
].Cells[0];
4070
_dataGridView.CurrentCell = _dataGridView.Rows[_dataGridView.
NewRowIndex
].Cells[1];