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...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With