Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

datagridview1 visual studio vb 2010 ultimate multi column sort

Posted on 2010-09-16
9
Medium Priority
?
538 Views
Last Modified: 2012-05-10
I need to be able to sort on 2 columns at the same time like you can in excel sorting.  how can i achieve this?
0
Comment
Question by:mphillip85
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
ID: 33698479
is your datagridview databound?
When the DataGridView control is bound to an external data source by setting the DataSource property, the Sort(DataGridViewColumn,ListSortDirection) method overload does not work for unbound columns. Additionally, when the VirtualMode property is true, you can call this overload only for bound columns. To determine whether a column is data-bound, check the IsDataBound property value. Sorting unbound columns in bound mode is not supported.
so you can use
Me.DataGridView1.Sort(Me.DataGridView1.Columns("SortCol"), System.ComponentModel.ListSortDirection.Ascending)
0
 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
ID: 33698503
the link is for gridview not datagridview
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
ID: 33698523
0
 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
ID: 33698538
You may read my attchment..VERY HELPFULL
DGV-Sort.docx
0
 
LVL 17

Expert Comment

by:Zhaolai
ID: 33698540
0
 
LVL 18

Accepted Solution

by:
John (Yiannis) Toutountzoglou earned 2000 total points
ID: 33698549
@Zhaolai
"Here is the solution:
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Controls/Q_21830168.html"
It exaclty my first Post :)
0
 
LVL 17

Expert Comment

by:Zhaolai
ID: 33700940
Ah, @jtoutou, but you did not explain how to implement it.
0
 

Author Closing Comment

by:mphillip85
ID: 33750398
it has helped me to work out a scenario to use against the dgview multi column sort.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

636 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