Sort an array (structure array)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

Suppose I have defined a structure....

Structure RenameDocs
Public Facility As String
Public Document As String
Public Subtitle As String
Public Page As String
End Structure

And then declared an array of this structure...

Public stRenameDocs() As RenameDocs

Through the course of processing, the array becomes populated with data.
Now I need to sort the array by Facility, Document, Subtitle.

I'm at a loss as to how I should approach this. Any suggestions?

Thanks,
Mark
 
Mark,

Have your structure implement IComparable and then use Array.Sort.

Kerry Moorman
 
Mark said:
Suppose I have defined a structure....

Structure RenameDocs
Public Facility As String
Public Document As String
Public Subtitle As String
Public Page As String
End Structure

And then declared an array of this structure...

Public stRenameDocs() As RenameDocs

Through the course of processing, the array becomes populated with data.
Now I need to sort the array by Facility, Document, Subtitle.

See:

<URL:http://dotnet.mvps.org/dotnet/samples/techniques/CompareOperator.zip>
 
Back
Top