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