Reputation: 14953
how to select all rows in DataGridView on pressing a button ?
i work on C# winforms
Upvotes: 9
Views: 23161
Reputation: 44605
as easy as calling SelectAll :)
make sure the property multiselect
is set to true
Upvotes: 9
Reputation: 189
dataGridView.SelectAll()
this selects all the DatagridView including the ColumnHeaders . But if you want that the ColumnHeaders will not be included
dataGridView.ColumnHeaders.Visible = false;
dataGridView.SelectAll();
dataGridView.ColumnHeaders.Visible = true;
Please vote :) Thanks a lot...
Upvotes: 4