troubleshooting Question

Sort array of strongly typed DataRows

Avatar of ElrondCT
ElrondCTFlag for United States of America asked on
Visual Basic.NET
3 Comments1 Solution424 ViewsLast Modified:
I'm sure I'm missing something obvious, but I can't figure out how to sort an array of DataRows that have been drawn from a DataTable. I'm getting the child rows for a particular parent record using

dim drChildA() as dsSet.ChildARow = drParent.GetChildARows

I want to sort these rows, because I can't be certain they were entered in the proper order. (The primary key is a simple counter that's autoincremented for every new record, so it's not useful for this purpose.)

It seems to me there ought to be a way to choose a particular field (or fields) of the DataRow to use to sort, but I can't figure out how to put that into the structure of the Array.Sort method short of defining my own IComparer; I can do that, but it seems like it ought to be reinventing the wheel.
ASKER CERTIFIED SOLUTION
graye

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros