In a DataGridView I need to count how many duplicate values a column has.
DataGridView
This is my Datagridview:
For example, I\'d like to count how many
Well, you could just iterate through the rows and increment your counting variable if row.Cells[0] is "X". Here's a LINQ solution.
row.Cells[0]
int xCount = dataGridView.Rows .Cast() .Select(row => row.Cells["RisFin"].Value.ToString()) .Count(s => s == "X");