Imports Infragistics.Win
Imports Infragistics.Win.UltraWinTabs
Imports Infragistics.Win.UltraWinTabControl
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
    ' The VisibleTabs collection exposes a Sort method
    ' with 3 overloads.
    ' Calling the method without any parameters will do
    ' an ascending case-sensitive sort based on the
    ' tabs' Text values.
    Me.ultraTabControl1.VisibleTabs.Sort()
    ' The second overload allows you to specify whether
    ' to sort ascending or descending based on the 
    ' tabs' (case-sensitive) Text values
    Me.ultraTabControl1.VisibleTabs.Sort(SortDirection.Descending)
    ' The third overload allows you to specify a custom
    ' comparer. In this case, a comparer that will do a 
    ' case-insensitive sort.
    Me.ultraTabControl1.VisibleTabs.Sort(New MyTabComparer(SortDirection.Descending))
    ' Calling the Sort method affects tab placement in the
    ' 'VisibleTabs' collection and changes each tab's 'VisibleIndex'
    ' property but does not affect the tab's 'Index' property or
    ' its position in the 'Tabs' collection.
    ' Tab placement in the 'VisibleTabs' collection can
    ' also be changed by setting the tab's 'VisibleIndex'
    ' property or calling its 'Reposition' method
    Dim utab As UltraTab = Me.ultraTabControl1.Tabs(2)
    utab.VisibleIndex = 0
    utab.Reposition(Me.ultraTabControl1.Tabs(1), RelativePosition.Before)
    ' The 'VisibleTabs' collection also exposes properties and
    ' methods for filtering out non-selectable tabs, i.e. tabs
    ' whose 'Visible' or 'Enabled' property is set to false.
    utab = Me.ultraTabControl1.VisibleTabs.FirstSelectableTab
    utab = Me.ultraTabControl1.VisibleTabs.LastSelectableTab
    utab = Me.ultraTabControl1.VisibleTabs.GetNextSelectableTab(utab, True)
    utab = Me.ultraTabControl1.VisibleTabs.GetPreviousSelectableTab(utab, True)
    ' Note: the 2nd parameter to the method calls above specifies
    ' whether to wrap around when the last or first selectable tab
    ' is passed in.
End Sub
Private Class MyTabComparer
    Implements IComparer
    Private direction As SortDirection
    Public Sub New(ByVal direction As SortDirection)
        Me.direction = direction
    End Sub
    Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements System.Collections.IComparer.Compare
        Dim tab1 As UltraTab = x
        Dim tab2 As UltraTab = y
        Dim string1 As String = tab1.Text
        Dim string2 As String = tab2.Text
        Dim ret As Integer
        If string1 Is Nothing Then
            ret = -1
        ElseIf string2 Is Nothing Then
            ret = 1
        Else
            ' Do a case-insensitive compare
            ret = String.Compare(string1, string2, True, System.Globalization.CultureInfo.CurrentCulture)
        End If
        ' If descending then flip the sign
        If Me.direction = SortDirection.Descending Then
            ret *= -1
        End If
        Return ret
    End Function
End Class