NDraskovic
NDraskovic

Reputation: 706

Programmatically clicking on dataGridView header cells

How can I programmatically perform click on a certain dataGridView column header? I want to have the data sorted, but the when I sort the data using SQL ORDER BY I get some weird results (I think it is because the data has some Croatian letters as starting chars). However, the dataGridView sorts it correctly when I click on the column header. So how can I do that automatically on display? Thanks

Upvotes: 1

Views: 2036

Answers (2)

Dan
Dan

Reputation: 45762

Just use the DataGridView sort method

Upvotes: 1

RhysW
RhysW

Reputation: 453

datagridview.sort(DataGridviewColumn column, System.ComponentModel.ListSortDirection direction);

code to sort a datagridview by column and direction.

Upvotes: 4

Related Questions