Solved

Sort list box, vb.net

Posted on 2014-11-13
1
317 Views
Last Modified: 2014-11-14
I have the following list box made with multiple columns:sortI want to be able to sort this list box by one column (any of those at display).

Question: How can I do this?

I know, I could capture Y position at mouse down (this will help me to identify when the header area is clicked). I can also capture X position if column widths doesn't change.

So mouse down even alone could help me to identify what column has been clicked on. But I have to be able either:
a. Keep the column widths fixed, or
b. Read the column widths when the list box gets filled in.

Could you possibly think of a solution for a and/or b above.

Gridview is a good option but I want something very light weight. Are there some other middle ground controls like ListView we had in vb 6.0?

Thanks.
0
Comment
Question by:Mike Eghtebas
[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
1 Comment
 
LVL 53

Accepted Solution

by:
Huseyin KAHRAMAN earned 500 total points
ID: 40441831
ListView here
http://msdn.microsoft.com/en-us/library/system.windows.forms.listview(v=vs.110).aspx

' Sort the items in the list in ascending order.
listView1.Sorting = SortOrder.Ascending

Custom sorting
The following code example creates a form that contains a ListView control that manually sorts items when a column in the ListView control is clicked.
http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.listviewitemsorter(v=vs.110).aspx
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…

738 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