Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

This is kind of weird, so hopefully someone can answer this. I'm populating a listview control from multiple text files, however, I'm getting an error: "

 

An unhandled exception of type 'System.InvalidOperationException' occurred in system.windows.forms.dll

 

Additional information: This collection has reached its maximum capacity.

 

"

 

Here is my code:

 

If iNotFound = 1 Then
     sTmpUserNms.Add(iNmCnt, aLocVals(1))
     Dim Item1 As New Windows.Forms.ListViewItem.ListViewSubItem(iTmp, sTmpUserNms(iNmCnt).ToString)
     'iTmp.Text = aValues(0)
     iTmp.SubItems.Add(Item1)
     'iTmp.SubItems.Add(Item2)
     'lstData.Items.Add(iTmp)
      iNmCnt += 1
End If

 

I get the error at "iTmp.SubItems.Add(Item1)". I get it when it is trying to add the 4096 item. And I only get it when I have "lstData.Items.Add(iTmp)" commented out. However, when I uncomment that, I get the error:"

 

An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll

 

Additional information: Cannot add or insert the item '' in more than one place. You must first remove it from its current location or clone it.

 

"

 

Please help!

If it works... don't worry, I'll fix it.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...