473,320 Members | 2,027 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Exception of sorting a listview

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'.

Anybody can give a hand?

Thanks in advance
Nov 21 '05 #1
2 1290
Hi

I tried what you said. Added items in the listview, specified Sorting
property. Then added items again prohgramatically. I did'nt get any
exception. Can you give the source code?

Regards
Sooraj
Microsoft Community Star

"Li Pang" wrote:
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'.

Anybody can give a hand?

Thanks in advance

Nov 21 '05 #2
Thanks Sooraj for your response. The codes are too long to analyse, I will
giveup this issue. I appreciate.

"Sooraj PM" wrote:
Hi

I tried what you said. Added items in the listview, specified Sorting
property. Then added items again prohgramatically. I did'nt get any
exception. Can you give the source code?

Regards
Sooraj
Microsoft Community Star

"Li Pang" wrote:
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'.

Anybody can give a hand?

Thanks in advance

Nov 21 '05 #3

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

Similar topics

0
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...
0
by: Samuel R. Neff | last post by:
I'm impleneting a custom ListView with column sorting support and am deciding whether to reuse the Sorting property to indicate direction or create a new property. The only drawback I see is that...
0
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...
19
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...
3
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...
2
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...
2
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...
3
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...
2
by: win | last post by:
The SortKey of VB6 is not in .Net. Can I still do sorting using a listview? Thanks
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.