Solved

datagridview1 visual studio vb 2010 ultimate multi column sort

Posted on 2010-09-16
9
531 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 4

Expert Comment

by:antonybrahin
ID: 33698489
0
 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
ID: 33698503
the link is for gridview not datagridview
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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 500 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 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