简体   繁体   中英

how to select all rows in DataGridView?

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

i work on C# winforms

DataGridView.SelectAll Method

as easy as calling SelectAll :)

make sure the property multiselect is set to true

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...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM