在 DataGridView 控件的最后一行获取一些单元格,可以通过以下方法实现:
int rowCount = dataGridView.RowCount;
int columnCount = dataGridView.ColumnCount;
DataGridViewCell lastRowCell = dataGridView.CurrentCell;
DataGridViewRow lastRow = dataGridView.Rows[rowCount - 1];
DataGridViewCell lastRowCell = dataGridView.Rows[rowCount - 1].Cells[columnIndex];
DataGridViewCell lastRowCell = dataGridView.SelectedCells[rowCount - 1];
DataGridViewRow lastRow = dataGridView.CurrentRow;
DataGridViewCell lastRowCell = dataGridView.Rows[rowCount - 1].Cells[columnIndex];
DataGridViewCell lastRowCell = dataGridView.Rows[rowCount - 1].SelectedCells[columnIndex];
DataGridViewCell lastRowCell = dataGridView.CurrentRow.Cells[columnIndex];
DataGridViewCell lastRowCell = dataGridView.CurrentRow.SelectedCells[columnIndex];
通过以上方法,您可以在 DataGridView 控件的最后一行获取一些单元格。
领取专属 10元无门槛券
手把手带您无忧上云