I have a datagrid view in my form and I like to sort the table by clicking the columnheader.
I choose the Columnheader DoubleClick Event for writing the code but I don’t know, how I should tell which column header is selected.
Is there any way for it or I have to change my mind?
Look at the DataGridView’s ColumnHeaderMouseClick event.
When the event fires you can get the index value of the clicked column through the event’s DataGridViewCellMouseEventArgs.ColumnIndex property. The article I linked has an example.