sorting a datagrid

Hello Experts,

I have a question related to sorting a data grid. The grid holds rows of an order. The last column of each row is a supplier row. What I want to do is sort the rows into sublists into a master list.

for example, if the order is as follows

row/ supplier
1) a
2) a
3) b
4) a
5) b

I create an array list holding 2 array lists, one for each distinct item in the grid (a and b). Here is where I run into trouble. I read the data for each column per row. How can I sort the row into the proper list during runtime? I need to have a master list that holds sub lists of each supplier.

Who is Participating?

Improve company productivity with a Business Account.Sign Up

mjdealeConnect With a Mentor Commented:
mydatagridview.Sort(datagridviewColumn, Direction(asc or Desc))
This is the perfect site, which tells you how to sort data on multiple columns,
as above mentioned problem can be solved by using sort on multiple columns
hope it will help you
DEEPESHConnect With a Mentor Commented:
Dim view As DataView = DataTable1.DefaultView

    ' By default, the first column sorted ascending.
    view.Sort = "State, ZipCode DESC"
saculAuthor Commented:

Awesome, just plain awesome. hit the nail right one the head and you will get the accepted answer....but I will split the points since the link that DEEPESH posted has alot of valuable information.

Thanks alot for the help. True experts indeed.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.