Getting selected datagridview items

DanielB33

Active member
Joined
Mar 29, 2013
Messages
40
Programming Experience
1-3
I have a datagridview with 11 columns and potentially thousands of rows. The user will sometimes need to make graphs from the data. I need to know which cells are selected. Surprisingly, the graph is easier than getting these selected items! Does anyone know how to do this? I would like to have the control/flexibility to know if the user selected the second column and fourth column, second column from cell 2-100 and column and fourth from 400 thru 700. Is this possible? Thanks.
 
If you want to know what cells are selected then the obvious solution is to use the SelectedCells collection. Each cell has a ColumnIndex and a RowIndex, so it's easy to know which row and column they are from.
 
Back
Top