简体   繁体   中英

Sort multiple column in notepad using vb.net

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM