0

I am doing a project that requires me to transfer data from one notepad to another notepad (saved using excel tab delimited form).

I have successfully done that, the only that left is I need to sort those data after transferring it.

For your information, I am transferring 5 column from the first notepad to the second notepad. I saved those information in five arrays.

How am I supposed to sort them after pasting?

I tried using vb.net sort function but that only will sort one array while the rest of the arrays wont follow.

I tried lines.sort also but the result is not satisfying, any other idea to sort those data like what we normally do manually in excel?

Any help will be very much appreciated.

Elydasian
  • 2,016
  • 5
  • 23
  • 41
  • Can you share the code you have already written? – Robin Mackenzie Jun 13 '16 at 09:30
  • Create a class to hold your data (each row). Create a list of that class to hold all the data then use Linq to sort it. Here's a [sample](http://stackoverflow.com/questions/298725/multiple-order-by-in-linq) how to sort it. – Han Jun 13 '16 at 12:21

1 Answers1

0

One solution would be to create an object with 5 values in it. Then you would create an list of those objects (that way the values are all linked).

Then you would just do:

OBJECT.Sort(Function(x, y) x.valueToSortBy.CompareTo(y.valueToSortBy))

This would give you a list of your objects sorted by the value you wanted.

Sastreen
  • 597
  • 4
  • 13