josef_skywalker josef_skywalker - 10 months ago 53
C# Question

Return a List of distinct values from DataGridView

As the topic says: Is there a way to return a list of distinct values from a certain Column of a DataGridView?

Answer Source

This should do what you asked for:

var vv = dataGridView1.Rows.Cast<DataGridViewRow>()
                           .Select(x => x.Cells[yourColumn].Value.ToString())