josef_skywalker josef_skywalker - 1 year ago 128
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())
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download