how to select all rows in DataGridView on pressing a button ?
i work on C# winforms
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.