When I click a column header for sorting application and then aplication has a error.
Test project link :
Thank you for the sample.
The issue in the sample is that .ToList() converts the table to a list and .NET lists don’t support column sorting. They have only one Sort() method which either uses the default comparer or requires a custom comparer.
In you sample you can simply assign the Table<customer> to the data source:
dataGridView1.DataSource = veri.customers; // instead of dataGridView1.DataSource = veri.customers.ToList();
In alternative, if you want to sort the list you need to implement a SortableBindingList<T>: http://stackoverflow.com/questions/23661195/datagridview-using-sortablebindinglist