Phreak Posted June 11, 2003 Posted June 11, 2003 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! Quote If it works... don't worry, I'll fix it.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.