OK,
Since you have no control over this class, and I doubt it implements
IComparable, you will need to find a property on the class you want to
sort by, that is a native type, such as String. Then you can do this:
Public Class AnObjectThatImplementsIComparer
Implements IComparer
Public Function Compare(ByVal x As Object, ByVal y As Object)
As Integer Implements System.Collections.IComparer.Compare
Dim adx As ActiveDirectory.ActiveDirectory.ADGroup
Dim ady As ActiveDirectory.ActiveDirectory.ADGroup
adx = CType(x, ActiveDirectory.ActiveDirectory.ADGroup)
ady = CType(y, ActiveDirectory.ActiveDirectory.ADGroup)
Return adx.SomeProperty.CompareTo(ady.SomeProperty)
End Function
End Class
which will sort your collection based on the value SomeProperty. Just
replace SomeProperty with the name of the property you want to sort on.
--- In [email protected], "Hoenig, Robert"
<[EMAIL PROTECTED]> wrote:
> Here is a what I did
>
> Dim type As String = Usergroups(0).GetType().ToString()
>
> type = "ActiveDirectory.ActiveDirectory.ADGroup"
>
>
>
> Thank you,
> Robert Hoenig
> Business System Analyst
>
> Johann A. Krause, Inc.
> 305 W Delavan Drive
> Janesville, WI 53547
> Phone: +1 (608) 741-4863
> Fax: +1 (608) 757-7066
> E-Mail: [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
> Web: www.gilmanassembly.com
> <blocked::http://www.gilmanassembly.com/>
>
>
>
>
> ________________________________
>
> From: [email protected]
> [mailto:[EMAIL PROTECTED] On Behalf Of Dean Fiala
> Sent: Wednesday, June 15, 2005 2:19 PM
> To: [email protected]
> Subject: Re: [AspNetAnyQuestionIsOk] Re: ArrayList Sorting
>
>
> OK,
> To find the type you can always use .GetType()
>
> usergroups(0).getType().ToString()
>
> will tell you the type of the first element in usergroups
>
> Let me know what it is and we'll go from there.
>
>
> --
> Dean Fiala
> Very Practical Software, Inc
> http://www.vpsw.com
>
>
> ________________________________
>
> Yahoo! Groups Links
>
>
> * To visit your group on the web, go to:
> http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
>
> * To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]
> cribe>
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/> .
>
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>
>
>
> This email has been scanned by the Gilman Engineering &
Manufacturing, LLC
> Email Security System.
>
>
> [Non-text portions of this message have been removed]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/