I populate my datagridview using
dataGridView1.DataSource = ListOfClasses
This fills everything out properly. Now I like to make the columns sortable. They don't seem to sort even though the two columns I tried were longs and a string. I tried running this after the datasource (before gives me an exception as the columns dont exist)
foreach (DataGridViewColumn column in dataGridView1.Columns)
{
dataGridView1.Columns[column.Name].SortMode = DataGridViewColumnSortMode.Automatic;
}
I can sort them initially using order by in sql however i still like the flexibility choosing with columns. How do i enable that