[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 283
  • Last Modified:

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.

Thanks,
Zac
0
sacul
Asked:
sacul
  • 2
2 Solutions
 
mjdealeCommented:
mydatagridview.Sort(datagridviewColumn, Direction(asc or Desc))
0
 
DEEPESHCommented:
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
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=677968&SiteID=1
0
 
DEEPESHCommented:
Dim view As DataView = DataTable1.DefaultView

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

Awesome, just plain awesome. mjdeale..you 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.

Zac
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now