3
I wonder how I do to select all the Rows
of a DataGridView
.
Code that I have:
DataGridView.Rows[0].Cells[0].Value.ToString();
3
I wonder how I do to select all the Rows
of a DataGridView
.
Code that I have:
DataGridView.Rows[0].Cells[0].Value.ToString();
4
Use the method DataGridView.SelectAll
to select all lines:
dataGridView1.SelectAll();
To select the rows of a specific column, do so, for example in click
one-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
}
Browser other questions tagged c#
You are not signed in. Login or sign up in order to post.
Is there any way to adapt in mine? In case I want the Cells[0] of all lines.
– enzo
But this code returns nothing, only clears the selection, traverses the
dataGrid
and selects the rows based on the column. In any case, if you want to open a new question and explain what you intend to do, it may be possible to reach a solution.– stderr
@But no longer answered here and here? (delete previous comments if possible!)
– stderr
Yeah, it didn’t turn out the way I wanted it, but I’ll leave it at that. thanks.
– enzo