I would like to know how I can select all Rows
of a DataGridView
.
Code that I have:
DataGridView.Rows[0].Cells[0].Value.ToString();
I would like to know how I can select all Rows
of a DataGridView
.
Code that I have:
DataGridView.Rows[0].Cells[0].Value.ToString();
Use the DataGridView.SelectAll
method to select all the lines:
dataGridView1.SelectAll();
To select the rows of a specific column, do so, for example in click
of a button:
void Button1Click(object sender, EventArgs e)
{
dataGridView1.ClearSelection();
for(int i = 0; i < dataGridView1.RowCount; i++)
dataGridView1[0, i].Selected = true; // "0" Indica a primeira coluna
}