Search code examples
datagridviewcountselecteddatagridviewcolumn

How to get the selected cells count from a particular column of a DataGridView



I am looking for a way to get selected cells count from a specific DataGridView column. I am able to retrieve all the selected cells from the DataGridView, but not from the specific column, with the help of MSDN link.

I tried using this piece of code, but it is returning selected cell count from entire grid.

SelectedCellsCount = dataGridView1.Columns[<<Column Name >>].DataGridView.SelectedCells.Count; 

Can anyone please help me out to get this done ?

Thanks in advance.
Regards,
Vijay


Solution

  • Found workaround to this. Now I am fetching all selected cells from the grid and depending upon the column index operating on it.