Solved

sorting a datagrid

Posted on 2006-11-14
4
244 Views
Last Modified: 2010-04-23
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
Comment
Question by:sacul
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
mjdeale earned 380 total points
ID: 17939431
mydatagridview.Sort(datagridviewColumn, Direction(asc or Desc))
0
 
LVL 5

Expert Comment

by:DEEPESH
ID: 17939736
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
 
LVL 5

Assisted Solution

by:DEEPESH
DEEPESH earned 120 total points
ID: 17939752
Dim view As DataView = DataTable1.DefaultView

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

Author Comment

by:sacul
ID: 17943609
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Exit the loop 4 43
HTML - Color not displaying correctly in EMAIL. 6 40
Obtain cell value using column ID in DataGrid using VB.NET 2 19
vb.net and creating a class 5 17
This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question