I have a datagridview named "dgvStudents" and DO NOT want user to click the heading to sort it.

I found the following code but don't know how to incorporate in my code. Can someone please help ?

Public Class CustomDataGrid
Inherits DataGrid

Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
Dim point As New Point(e.X, e.Y)
Dim hti As DataGrid.HitTestInfo = HitTest(point)

' don't sort column 1
If hti.Type = HitTestType.ColumnHeader AndAlso hti.Column = 1 Then
Return
End If

MyBase.OnMouseDown(e)
End Sub

End Class