473,385 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Sort an array (structure array)

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

Mar 1 '07 #1
2 2525
Mark,

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

Kerry Moorman
"Mark" wrote:
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
Mar 1 '07 #2
"Mark" <Ma**@discussions.microsoft.comschrieb:
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>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Mar 2 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Håvard Olerud Eriksen | last post by:
I've got an array of arrays that I need to sort on preferably one of the indices of the nested array, keeping the order of the outside array. The structure is like this: array( => array(key =>...
2
by: jagg | last post by:
Hi, with the code below the output is sort by $verantw but $title and $file in the same row DON'T belong to $verantw. How do I have to make the sort command that $verantw, $title and $file in...
4
by: Brett | last post by:
I have two arrays and i wish to sort the first one numerically, but after sorting, I would like the second array to be in the same matching order as the first array. ie. @l1={3,1,2};...
40
by: Elijah Bailey | last post by:
I want to sort a set of records using STL's sort() function, but dont see an easy way to do it. I have a char *data; which has size mn bytes where m is size of the record and n is the...
5
by: xah | last post by:
i'm just starting out on javascript. can anyone show me how to go about writing a code to sort a table column? something like the following: <table border="1"> <tr> <td>
21
by: yeti349 | last post by:
Hi, I'm using the following code to retrieve data from an xml file and populate a javascript array. The data is then displayed in html table form. I would like to then be able to sort by each...
5
by: Jan Smith | last post by:
I've searched the overloads for the Array.Sort method, and I haven't found a clear answer to my question. Maybe it's not in Array.Sort. Here's the question: I initialize an array X with the...
4
by: philip | last post by:
Public Class Form1 Public Structure Identity Public firstname As String Public name As String End Structure I declared a array of a structure : Private Sub Form1_Load(ByVal sender As...
1
by: wartech | last post by:
Hey everyone, My objective here is to be able to sort the array that i created from a structure. When I attempt to do this I get a message stating "Failed to compare two elements in the array". ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.