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)
74NewRowIndex = Rows.Count - 1; 5365NewRowIndex = -1; // No more 'new' row. 5369NewRowIndex--; 5391NewRowIndex += insertionCount; 5475NewRowIndex = Rows.Count - 1; 10593NewRowIndex = rowIndex; 13230NewRowIndex = -1; 14589NewRowIndex = -1;
99 references to NewRowIndex
System.Windows.Forms (97)
System\Windows\Forms\Controls\DataGridView\DataGridView.DataConnection.cs (11)
412if (!_dataConnectionState[DATACONNECTIONSTATE_finishedAddNew] && _owner.NewRowIndex == e.NewIndex) 596if (_owner.NewRowIndex == -1 || e.NewIndex != _owner.Rows.Count) 719CurrencyManager.Position == _owner.NewRowIndex && // condition 4. 720_owner.CurrentCellAddress.Y != _owner.NewRowIndex && // condition 5. 766Debug.Assert(_owner.NewRowIndex != -1, "the NewRowIndex is -1 only when AllowUserToAddRows is false"); 770if (_owner.CurrentCellAddress.Y != _owner.NewRowIndex || _owner.IsCurrentRowDirty) 829if (_owner.NewRowIndex == CurrencyManager.List.Count) 832deleteAddNewRow = (rowIndex == _owner.NewRowIndex - 1); 837Debug.Assert(_owner.NewRowIndex == CurrencyManager.List.Count - 1); 838deleteAddNewRow = (rowIndex == _owner.NewRowIndex); 1356if (e.RowIndex != _owner.NewRowIndex
System\Windows\Forms\Controls\DataGridView\DataGridView.Methods.cs (49)
71Debug.Assert(NewRowIndex == -1); 79DataGridViewRowEventArgs dgvRowEvent = new(Rows[NewRowIndex]); 89NewRowIndex + (AppContextSwitches.DataGridViewUIAStartRowCountAtZero ? 0 : 1))); 3259if (discardNewRow && _ptCurrentCell.Y == NewRowIndex - 1) 3267if (!IsCurrentRowDirty && _ptCurrentCell.Y == NewRowIndex - 1 && _dataGridViewState1[State1_NewRowCreatedByEditing]) 5363if (NewRowIndex == rowIndexDeleted) 5367else if (NewRowIndex != -1) 5389if (NewRowIndex != -1) 5453Debug.Assert(NewRowIndex != -1); 5455DataGridViewRowCancelEventArgs dgvrce = new(Rows[NewRowIndex]); 5463Debug.Assert(NewRowIndex == Rows.Count - 1); 5464DataGridViewRow dataGridViewRow = Rows[NewRowIndex]; 5465Rows.RemoveAtInternal(NewRowIndex, force: false); 5471Debug.Assert(NewRowIndex == -1); 5476Debug.Assert((Rows.GetRowState(NewRowIndex) & DataGridViewElementStates.Visible) != 0); 5477Debug.Assert(_ptCurrentCell.Y == NewRowIndex); 5479OnDefaultValuesNeeded(new DataGridViewRowEventArgs(Rows[NewRowIndex])); 5480InvalidateRowPrivate(NewRowIndex); 10588if (AllowUserToAddRowsInternal && NewRowIndex == -1) 10796if (dataGridViewColumn.CellTemplate!.DefaultNewRowValue is not null && NewRowIndex != -1) 10800_ = Rows[NewRowIndex]; 10814if (rowIndex == NewRowIndex) 10941if (dataGridViewColumn.CellTemplate!.DefaultNewRowValue is not null && NewRowIndex != -1) 10945_ = Rows[NewRowIndex]; 10966if (rowIndex == NewRowIndex) 14584if (IsCurrentCellDirty && NewRowIndex == _ptCurrentCell.Y) 15431if (dataGridViewColumn.CellTemplate!.DefaultNewRowValue is not null && NewRowIndex != -1) 15435_ = Rows[NewRowIndex]; 15449if (rowIndex == NewRowIndex) 17266Debug.Assert(NewRowIndex != -1); 17267Debug.Assert(NewRowIndex == Rows.Count - 1); 17668if (!validationFailureOccurred && AllowUserToAddRowsInternal && NewRowIndex == rowIndex) 17674DataGridViewRowEventArgs dgvre = new(Rows[NewRowIndex]); 17695InvalidateRowPrivate(NewRowIndex); 17700Debug.Assert(NewRowIndex == -1, "newRowIndex and AllowUserToAddRowsInternal became out of sync"); 18769if (rowIndex == NewRowIndex) 19086if (DataSource is not null && _ptCurrentCell.X >= 0 && AllowUserToAddRowsInternal && NewRowIndex == _ptCurrentCell.Y) 19776if (NewRowIndex != -1) 19778DataGridViewRow newRow = Rows.SharedRow(NewRowIndex); 19784newRow = Rows[NewRowIndex]; // un-share the 'new row'. 19792dataGridViewCell.SetValueInternal(NewRowIndex, dataGridViewCell.DefaultNewRowValue); 19955if (rowIndex == NewRowIndex || rowIndex >= Rows.Count) 19976if (NewRowIndex < rowCount) 25334if (Columns.Count > 0 && NewRowIndex == -1) 25339else if (NewRowIndex != -1) 25342Debug.Assert(NewRowIndex == Rows.Count - 1); 25343Rows.RemoveAtInternal(NewRowIndex, force: false); 28350Debug.Assert(rowIndex1 != NewRowIndex); 28351Debug.Assert(rowIndex2 != NewRowIndex);
System\Windows\Forms\Controls\DataGridView\DataGridViewBand.cs (2)
695DataGridView.NewRowIndex != -1 && 696DataGridView.NewRowIndex == Index &&
System\Windows\Forms\Controls\DataGridView\DataGridViewButtonCell.cs (1)
427DataGridView.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)
161DataGridView.NewRowIndex == RowIndex &&
System\Windows\Forms\Controls\DataGridView\DataGridViewLinkCell.cs (1)
671DataGridView.NewRowIndex != rowIndex &&
System\Windows\Forms\Controls\DataGridView\DataGridViewRow.cs (3)
74&& Index != DataGridView.NewRowIndex) 248get => DataGridView is not null && DataGridView.NewRowIndex == Index; 1246rowIndex != DataGridView.NewRowIndex)
System\Windows\Forms\Controls\DataGridView\DataGridViewRow.DataGridViewRowAccessibleObject.cs (1)
217if (_owningDataGridViewRow.DataGridView is not null && _owningDataGridViewRow.DataGridView.AllowUserToAddRows && _owningDataGridViewRow.Index == _owningDataGridViewRow.DataGridView.NewRowIndex)
System\Windows\Forms\Controls\DataGridView\DataGridViewRowCollection.cs (18)
224if (DataGridView.NewRowIndex != -1) 227Debug.Assert(DataGridView.NewRowIndex == Count - 1); 368if (DataGridView.NewRowIndex != -1) 371Debug.Assert(DataGridView.NewRowIndex == Count - 1); 406if (DataGridView.NewRowIndex != -1) 409Debug.Assert(DataGridView.NewRowIndex == Count - 1); 483if (DataGridView.NewRowIndex != -1) 486Debug.Assert(DataGridView.NewRowIndex == Count - 1); 548if (DataGridView.NewRowIndex != -1) 551Debug.Assert(DataGridView.NewRowIndex == Count - 1); 728if (DataGridView.NewRowIndex != -1) 731Debug.Assert(DataGridView.NewRowIndex == Count - 1); 1422if (DataGridView.NewRowIndex != -1 && rowIndex == Count) 1467if (DataGridView.NewRowIndex != -1 && rowIndex == Count) 1499Debug.Assert(DataGridView.NewRowIndex == -1 || rowIndex != Count); 1599if (DataGridView.NewRowIndex != -1 && indexDestination == Count) 1769if (DataGridView.NewRowIndex != -1 && rowIndex == Count) 2168if (DataGridView.NewRowIndex == index)
System\Windows\Forms\Controls\DataGridView\DataGridViewRowCollection.RowComparer.cs (2)
41if (_dataGridView.NewRowIndex != -1) 44if (rowIndex == _dataGridView.NewRowIndex)
System\Windows\Forms\Controls\DataGridView\DataGridViewRowHeaderCell.cs (6)
785else if (DataGridView.NewRowIndex == rowIndex) 800else if (DataGridView.NewRowIndex == rowIndex) 810else if (DataGridView.NewRowIndex == rowIndex) 941else if (DataGridView.NewRowIndex == rowIndex) 956else if (DataGridView.NewRowIndex == rowIndex) 966else 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];