You've forced me to extend the sorter class so much, that I see no other option other than adding it as an official code sample ... which I will probably do shortly 
It is fairly easy to extend the class to sort about anything you want it to, you just need to define the logic on what to sort each time.
The sample below extends the sorter class to sort on the Text property of any control that you will find within a Control type column of a ListView, and in case it's a Panel control, take it one step further and sort by the first control contained within the panel. The sample shows a ListView with 4 columns, one Text, one Number, one Control with a LinkLabel and finally one Control with a Panel that contains a Textbox.
You can extend the GetControlSortString() function at will to include the logic that you see fit for your case. If you for instance rather want to sort the LinkLabel on the Url, instead of the Text property, then it's trivial to add a new if statement to check for a LinkLabel and then return the Url.
Imports Gizmox.WebGUI.Forms
Imports Gizmox.WebGUI.Common
Imports Gizmox.WebGUI.Forms.ListViewItem
Public Class Form2
Private ListView1 As ListView
Private Sub BuildColumns()
Dim Ch As ColumnHeader = New ColumnHeader
Ch.Text = "Text"
Ch.Type = ListViewColumnType.Text
Ch.Width = 100
ListView1.Columns.Add(Ch)
Ch = New ColumnHeader
Ch.Text = "Number"
Ch.Type = ListViewColumnType.Number
Ch.Width = 100
ListView1.Columns.Add(Ch)
Ch = New ColumnHeader
Ch.Text = "LinkLabel"
Ch.Type = ListViewColumnType.Control
Ch.Width = 100
ListView1.Columns.Add(Ch)
Ch = New ColumnHeader
Ch.Text = "Panel"
Ch.Type = ListViewColumnType.Control
Ch.Width = 100
ListView1.Columns.Add(Ch)
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ListView1 = New ListView()
ListView1.Dock = DockStyle.Fill
Me.Controls.Add(ListView1)
BuildColumns()
' Load data
For i As Integer = 1 To 100
Dim LI As ListViewItem = New ListViewItem()
LI.SubItems.Add(i.ToString())
LI.SubItems.Add(i)
LI.SubItems.Add(New LinkLabel("LinkLabel " + i.ToString(), "http://www.visualwebgui.com"))
Dim P As Panel = New Panel()
Dim T As TextBox = New TextBox()
T.Dock = DockStyle.Fill
P.Controls.Add(T)
T.Text = "TextBox " + i.ToString()
LI.SubItems.Add(P)
ListView1.Items.Add(LI)
Next
ListView1.ListViewItemSorter = New MyLISorter(Me.ListView1)
End Sub
Public Class MyLISorter
Implements System.Collections.IComparer
Private mobjListView As ListView
Public Sub New(ByVal LI As ListView)
mobjListView = LI
End Sub
Private Function GetSortingColumns() As ICollection
Dim objSortData As ColumnHeaderSortingData = New ColumnHeaderSortingData(mobjListView)
Return objSortData.SortingColumns
End Function
Public Function GetControlSortString(ByVal C As Control) As String
' Customize logic at will. Return string suitable for sorting.
If C.GetType() Is GetType(Panel) Then
Dim P As Panel = CType(C, Panel)
If P.Controls.Count = 0 Then
' If no controls on panel, empty string
Return ""
Else
' Sort by the first control on the panel
Return GetControlSortString(P.Controls(0))
End If
Else
Return C.Text
End If
End Function
Public Function Compare(ByVal objObjectA As Object, ByVal objObjectB As Object) As Integer Implements System.Collections.IComparer.Compare
' Get list viewitems
Dim objItemA As ListViewItem = TryCast(objObjectA, ListViewItem)
Dim objItemB As ListViewItem = TryCast(objObjectB, ListViewItem)
Dim objSortingColumns As ICollection = Me.GetSortingColumns
' Check valid items
If objItemA IsNot Nothing AndAlso objItemB IsNot Nothing Then
' Check that there are columns
If objSortingColumns.Count = 0 Then
Return 0
Else
' Loop all sorting columns
For Each objColumn As ColumnHeader In objSortingColumns
' Get sorting direction
Dim intDirection As Integer = If((objColumn.SortOrder = SortOrder.Ascending), 1, -1)
' The comparison result
Dim intResult As Integer = 0
If objColumn.Type = ListViewColumnType.Number Then
intResult = CType(objItemA.SubItems(objColumn.Index).Text, Integer).CompareTo(CType(objItemB.SubItems(objColumn.Index).Text, Integer))
ElseIf objColumn.Type = ListViewColumnType.Control Then
' Compare controls
Dim objControlA, objControlB As ListViewSubControlItem
objControlA = objItemA.SubItems(objColumn.Index)
objControlB = objItemB.SubItems(objColumn.Index)
intResult = GetControlSortString(objControlA.Control).CompareTo(GetControlSortString(objControlB.Control))
Else
' Compare Text property by default
intResult = objItemA.SubItems(objColumn.Index).Text.CompareTo(objItemB.SubItems(objColumn.Index).Text)
End If
If intResult <> 0 Then
Return intResult * intDirection
End If
Next
Return 0
End If
Else
Return 0
End If
End Function
End Class
End Class