Gali
Gali

Reputation: 14953

how to select all rows in DataGridView?

how to select all rows in DataGridView on pressing a button ?

i work on C# winforms

Upvotes: 9

Views: 23161

Answers (2)

Davide Piras
Davide Piras

Reputation: 44605

DataGridView.SelectAll Method

as easy as calling SelectAll :)

make sure the property multiselect is set to true

Upvotes: 9

nate wew
nate wew

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

Related Questions