RemoveAt Property

  • Thread starter Thread starter marcmc
  • Start date Start date
M

marcmc

Any ideas on why the RemoveAt will give an
OutOfRangeException when I try to remove the last row. All
preceding rows on the ListView are removed without error.


While lstJP.Items.Count > 0
MessageBox.Show("1")
lstJP.Items.RemoveAt(0) ' OutOfRange
Exception??
End While
 
This puzzles me. The only other event I have attached to
the ListView is the following

Private Sub lstJP_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
lstJP.SelectedIndexChanged
txtJPInd.Text = lstJP.FocusedItem.Text
End Sub

I have also attempted the ListView.Items.Clear and I get a
NullReferenceException. Am I missing something obvious as
this seemed like such a simple task at the outset.
 
Hi,

Could you please send a simple application that reproduces the problem?

Thank you,
Sergiy.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Content-Class: urn:content-classes:message
| From: "marcmc" <[email protected]>
| Sender: "marcmc" <[email protected]>
| References: <[email protected]>
<#[email protected]>
| Subject: Re: RemoveAt Property
| Date: Tue, 5 Aug 2003 01:26:23 -0700
| Lines: 12
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcNbK0FBfjRZRfYpTZC1PonaI0zBxw==
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:30160
| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| This puzzles me. The only other event I have attached to
| the ListView is the following
|
| Private Sub lstJP_SelectedIndexChanged(ByVal sender As
| System.Object, ByVal e As System.EventArgs) Handles
| lstJP.SelectedIndexChanged
| txtJPInd.Text = lstJP.FocusedItem.Text
| End Sub
|
| I have also attempted the ListView.Items.Clear and I get a
| NullReferenceException. Am I missing something obvious as
| this seemed like such a simple task at the outset.
|
 
Back
Top