sorting a datagrid

sacul used Ask the Experts™
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.

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
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
Dim view As DataView = DataTable1.DefaultView

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



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.


Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial