473,765 Members | 2,086 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sorting of Listview

Hello All,

Can anybody tell me the how to sort a list view in vb.net,I have
used a list view in my project and the columns of the list view is
dynamically created.if i click on the header of any column i should be able
to sort that list view accordingly.Ple ase Help me
Thanks and Regards
Sudheer

Nov 20 '05 #1
3 1252
Cor
Hi Sudheer,

Here is an article how you can do it column by column

http://msdn.microsoft.com/library/de...stviewsort.asp

I hope this is what you are looking for?
Cor
Can anybody tell me the how to sort a list view in vb.net,I have
used a list view in my project and the columns of the list view is
dynamically created.if i click on the header of any column i should be able to sort that list view accordingly.Ple ase Help me

Nov 20 '05 #2
* "Sudheer Kareem" <su*****@bcinfo sys.com> scripsit:
Can anybody tell me the how to sort a list view in vb.net,I have
used a list view in my project and the columns of the list view is
dynamically created.if i click on the header of any column i should be able
to sort that list view accordingly.Ple ase Help me


You will find some samples for sorting listview items in C# here:

<http://www.codeproject .com/cs/miscctrl/#ListView+contr ols>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
"Sudheer Kareem" <su*****@bcinfo sys.com> schrieb
Hello All,

Can anybody tell me the how to sort a list view in vb.net,I
have
used a list view in my project and the columns of the list view is
dynamically created.if i click on the header of any column i should
be able to sort that list view accordingly.Ple ase Help me

http://support.microsoft.com/?id=319399

--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1739
by: rmorvay | last post by:
I have successfully integrated sorting in the listview control with the following code: Private Sub ListView_ColumnClick(ByVal sender As Object, ByVal e As System.Windows.Forms.ColumnClickEventArgs) Handles ListView.ColumnClick If ListView.Sorting = System.Windows.Forms.SortOrder.Ascending Then ListView.Sorting = System.Windows.Forms.SortOrder.Descending Else ListView.Sorting = System.Windows.Forms.SortOrder.Ascending
0
1221
by: Abhishek | last post by:
Hi! I am using listview control having 4 columns. I want it to behave in a similar manner as the details view of windows explorer. i.e it should sort on all the columns and all the columns should have the functionality to move horizontally (horizontal order of the columns) for this I am using Listview class . I reffred to MSDN and included a class which implements the System.Collections.IComparer interface that performs the ListViewItem
19
25466
by: Owen T. Soroke | last post by:
Using VB.NET I have a ListView with several columns. Two columns contain integer values, while the remaining contain string values. I am confused as to how I would provide functionality to sort columns based on the column header the user has clicked in both Ascending and Descending formats.
2
1318
by: Li Pang | last post by:
Hi, I use a listview to populate the data, and define a sorting direction with Me.ListView1.Sorting = System.Windows.Forms.SortOrder.Ascending so far no problem. As long as I add a new row into the listview programatically I got an error on sorting the data at above line: System Argument Exception: '-1' is not a valid value for 'index'.
3
472
by: Curtis | last post by:
I am trying to do a simple sort on a list view.With the listview control the first time I sort on the control it sorts the items but anytime after that it fails to sort. I'm sure this is a simple answer but anyways here is my code any help would be greatly apperciated. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load lvTest.Items.Add("1001") lvTest.Items.Add("5000")...
2
2133
by: MikeY | last post by:
Hi everyone, After reading various posts I'm still scratching my head and unsure of what approach to take. I have created buttons that upon clicking, the buttons add an item name (myName) to my ListView (lvBody) and at the same time, also add subitems(unitPrice); The problems is that if I don't have sort going on, then all "subitems" are fine. If I have sorting, then the "subitems" that are being placed above the last Alpha "subitems"...
2
7226
by: jediknight | last post by:
Hi, I have a listview which has columns of text and columns of numerical data. I need to be able to sort these columns into ascending/desending order whenever the user clicks on the column header. The text columns are sorted correctly but the numerical columns seem not to get sorted properly. For example I get the following result when I try to sort a numerical
2
1942
by: Steve Z. | last post by:
I am trying to implement the sorting of a ListView object by clicking on a column (using the example at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html/listviewsort.asp). While debugging it I get the following exception: An unhandled exception of type 'System.OutOfMemoryException' occurred in System.Windows.Forms.dll Additional information: Error creating window handle.
3
4637
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using vs2005, .net 2 for C# windows application. One of my column on the Listview control has numericstring. Other columns are sorting correctly except this one. It seems to be sorting the 1st numeric char at the beging of the string. How do I resolve this problem? Thank you? -- Thanks.
2
2446
by: win | last post by:
The SortKey of VB6 is not in .Net. Can I still do sorting using a listview? Thanks
0
9393
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10153
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8830
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7371
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6646
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5272
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5413
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3921
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.