By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,694 Members | 1,333 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,694 IT Pros & Developers. It's quick & easy.

ListView and DisplayIndex

P: n/a
Ken
I am adding items to a listview and I get an exception that seems to be
random.

"500 is not a valid value for displayindex"

I have searched the web looking for others with this problem and have found
a few. The problem is: I've found no real explanation/solution to the
problem - yet.

Someone has to know what this is - and how to handle it.

Is it a bug in vb.net?
Can it be swatted?

Thanks, Ken
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"Ken" <ks***@s32443t.com> schrieb
I am adding items to a listview and I get an exception that seems to
be
random.

"500 is not a valid value for displayindex"

I have searched the web looking for others with this problem and have
found a few. The problem is: I've found no real explanation/solution
to the problem - yet.

Someone has to know what this is - and how to handle it.

Is it a bug in vb.net?
Can it be swatted?


How many items are in the list? The index is 0-based. With 500 items, the
maximum index is 499.

Armin
Nov 21 '05 #2

P: n/a
Ken
Yes. The number of items in the list is 500 when I get the count. However,
the max index is 499 since it is 0-based. This has been tested and is
accurate. The problem still remains

Ken

"Armin Zingler" <az*******@freenet.de> wrote in message
news:eF**************@TK2MSFTNGP09.phx.gbl...
"Ken" <ks***@s32443t.com> schrieb
I am adding items to a listview and I get an exception that seems to
be
random.

"500 is not a valid value for displayindex"

I have searched the web looking for others with this problem and have
found a few. The problem is: I've found no real explanation/solution
to the problem - yet.

Someone has to know what this is - and how to handle it.

Is it a bug in vb.net?
Can it be swatted?


How many items are in the list? The index is 0-based. With 500 items, the
maximum index is 499.

Armin

Nov 21 '05 #3

P: n/a
"Ken" <ks***@s32443t.com> schrieb:
Yes. The number of items in the list is 500 when I get the count. However,
the max index is 499 since it is 0-based. This has been tested and is
accurate. The problem still remains


Please post relevant parts of the code.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4

P: n/a
Ken
I think you are talking about the code below. It is executed after each
addition to the listview.

If frmComm1.ListView1.Items.Count > 500 Then
frmComm1.ListView1.Items.RemoveAt(500)

I do not get the error every time 500 items are in the listview, the error
occurs randomly. The program could run for hours, even days before an error
occurs.

I found something here that seems to be the same type of problem.
http://service1.symantec.com/SUPPORT...ge&svy=&csm=no

Thanks for your help, this has been haunting me for a couple of months now.

Ken

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:O9**************@TK2MSFTNGP14.phx.gbl...
"Ken" <ks***@s32443t.com> schrieb:
Yes. The number of items in the list is 500 when I get the count. However, the max index is 499 since it is 0-based. This has been tested and is
accurate. The problem still remains


Please post relevant parts of the code.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.