[Webinar] Streamline your web hosting managementRegister Today

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

datagridview1 visual studio vb 2010 ultimate multi column sort

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
mphillip85
Asked:
mphillip85
1 Solution
 
John (Yiannis) ToutountzoglouInstructor Multiengine PilotCommented:
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
 
John (Yiannis) ToutountzoglouInstructor Multiengine PilotCommented:
the link is for gridview not datagridview
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

 
John (Yiannis) ToutountzoglouInstructor Multiengine PilotCommented:
0
 
John (Yiannis) ToutountzoglouInstructor Multiengine PilotCommented:
You may read my attchment..VERY HELPFULL
DGV-Sort.docx
0
 
ZhaolaiCommented:
0
 
John (Yiannis) ToutountzoglouInstructor Multiengine PilotCommented:
@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
 
ZhaolaiCommented:
Ah, @jtoutou, but you did not explain how to implement it.
0
 
mphillip85Author Commented:
it has helped me to work out a scenario to use against the dgview multi column sort.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

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