Error trying to sort custom class/collection

Hi everyone...

I have a class and collection in a current project (highly modfied version of MS's TaskVision), and am trying to sort the collection, but get the error:

Value of type 'TaskVision.ColumnRegistryKeyCollection.ColumnRegistryKeyFields' cannot be converted to 'System.Collections.IComparer'.

Here my calling code:
'************
        Dim column As New ColumnRegistryKey()
        Dim Columns As New ColumnRegistryKeyCollection()
        Columns = ColumnRegistryKey.Load()
        Columns.Sort(ColumnRegistryKeyCollection.ColumnRegistryKeyFields.Index)          ' <-- Error here
'************



Here's the basics of the ColumnRegistryClass:
'************

Public Class ColumnRegistryKey
    Private _Available As Boolean
    Private _ColumnName As String = String.Empty
    Private _ColumnType As String = String.Empty
    Private _HeaderText As String = String.Empty
    Private _Index As Integer
    Private _Visible As Boolean
    Private _Width As Integer

' (plus all Subs and Properties for given variables)

'************



And the basics of the collection class:
'************

Imports System
Imports System.Collections

Public Class ColumnRegistryKeyCollection
    Inherits ArrayList

    Public Enum ColumnRegistryKeyFields
        InitValue
        Available
        ColumnName
        ColumnType
        HeaderText
        Index
        Visible
        Width
    End Enum 'ColumnRegistryKeyFields

    Public Overloads Sub Sort(ByVal sortField As ColumnRegistryKeyFields, ByVal isAscending As Boolean)
        Select Case sortField
            Case ColumnRegistryKeyFields.Available
                MyBase.Sort(New AvailableComparer())
            Case ColumnRegistryKeyFields.ColumnName
                MyBase.Sort(New ColumnNameComparer())
            Case ColumnRegistryKeyFields.ColumnType
                MyBase.Sort(New ColumnTypeComparer())
            Case ColumnRegistryKeyFields.HeaderText
                MyBase.Sort(New HeaderTextComparer())
            Case ColumnRegistryKeyFields.Index
                MyBase.Sort(New IndexComparer())
            Case ColumnRegistryKeyFields.Visible
                MyBase.Sort(New VisibleComparer())
            Case ColumnRegistryKeyFields.Width
                MyBase.Sort(New WidthComparer())
        End Select
        If Not isAscending Then
            MyBase.Reverse()
        End If
    End Sub 'Sort

    Private NotInheritable Class AvailableComparer
        Implements IComparer 'ToDo: Add Implements Clauses for implementation methods of these interface(s)

        Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements System.Collections.IComparer.Compare
            Dim first As ColumnRegistryKey = CType(x, ColumnRegistryKey)
            Dim second As ColumnRegistryKey = CType(y, ColumnRegistryKey)
            Return first.Available.CompareTo(second.Available)
        End Function 'Compare
    End Class 'AvailableComparer

'...
' (and continued for remaining sortable items)
'...

'************

I've used this same code structure for the class and collection (except for replacing the names/variables) before without any issues ntil now, so I'm sure I'm forgetting something fairly simple...

Any thoughts?

Thanks in advance,
Chris
LVL 6
pillbug22Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

platinumbayCommented:
Try this:

http://www.ondotnet.com/pub/a/dotnet/2003/06/02/collectionbase.html

About halfway down is how to sort.
0
pillbug22Author Commented:
DOH!

(found it)

My .Sort() method needs 2 args and I was only passing one...must...need...sleep...
0
CetusMODCommented:
Question PAQ'd
125 points refunded.

CetusMOD
Community Support Moderator
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.