-2
I have a dataGridView on the screen and need that when the penultimate record is selected, I send the selection to the next line of the grid, which in case would be the last.
Summary of the problem:
I need to know when the selection is on the penultimate line of the grid, to apply a code to go to the next line, if this selection is on the penultimate line.
Part of the code below, the part going to the next line works, only the check is missing if it is the penultimate line that is selected.
private void MoveNext()
{
//Select a proxima linha caso:
//int last = this.dgvDados.CurrentRow.
if (//verificação aqui)
{
int index = this.dgvDados.CurrentRow.Index + 1;
index = index % this.dgvDados.Rows.Count;
this.dgvDados.CurrentCell = this.dgvDados.Rows[index].Cells[this.dgvDados.CurrentCell.ColumnIndex];
}
}
It was much simpler than I imagined, thank you very much!
– Gabriel Martins Gomes
I’m glad I could help.
– Jéf Bueno