Phreak
Well-known member
This is kind of weird, so hopefully someone can answer this. Im populating a listview control from multiple text files, however, Im 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:
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!
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:
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!