|
-
Oct 4th, 2006, 08:38 PM
#1
Thread Starter
Lively Member
How to prevent sorting in datagriview
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|