User Tools

Site Tools

blog:2024-12-11-003



2024-12-11 C#: Count the number of selected rows in a DataGridView

Solution

  • you need to set YourGridView.MultiSelect=true; MultiSelect When the MultiSelect property is set to true, multiple elements (cells, rows, or columns) can be selected in the DataGridView control. To select multiple elements, the user can hold down the CTRL key while clicking the elements to select. Consecutive elements can be selected by clicking the first element to select and then, while holding down the SHIFT key, clicking the last element to select.
  • then you can use SelectRows.Count property SelectedRows
  • 1
    MessageBox.Show(yourDataGridView.SelectedRows.Count.ToString())

TAGS

  • 4 person(s) visited this page until now.

Permalink blog/2024-12-11-003.txt · Last modified: 2024/12/11 09:46 by jethro

oeffentlich