Private Sub DataGridView1_ColumnHeaderMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView1.ColumnHeaderMouseClick Dim newColumn As DataGridViewColumn = DataGridView1.Columns(e.ColumnIndex) Dim direction As System.ComponentModel.ListSortDirection If DataGridView1.SortOrder = SortOrder.Ascending Then direction = System.ComponentModel.ListSortDirection.Descending Else direction = System.ComponentModel.ListSortDirection.Ascending End If If newColumn IsNot Nothing Then DataGridView1.Sort(newColumn, direction) End If End Sub