Hi Buz_88,
Welcome to MSDN forums.
To disable the sorting function of one DataGridView, please try the following code snippet:
Dim i As Integer
For i = 0 To DataGridView1.Columns.Count - 1
DataGridView1.Columns.Item(i).SortMode = DataGridViewColumnSortMode.Programmatic
Next i
or
Dim i As DataGridViewColumn
For Each i In dataGridView1.Columns
i.SortMode = DataGridViewColumnSortMode.NotSortable
Next i
Hope this helps. If you have any concern, please feel free to let me know.
Best regards,
Yichun Chen
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.