C# DataGridView Disable sort icon from the column header

Viewed 2038

I have a Winforms DataGridView with few columns which can be sorted and few which couldn't be. For columns which I don't want my gridview to be sorted I have set

dgvConnections.Columns[e.ColumnIndex].SortMode = DataGridViewColumnSortMode.NotSortable; in

dgvConnections_ColumnHeaderMouseClick event handler but I am unable to get rid of the the sort icon from the column header, as its presence could cause confusion to the user.

So kindly suggest me a way to get rid of the sorting icon from the column which cannot be sorted. Thanks in advance!

1 Answers
Related