• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1124
  • Last Modified:

Collection has reached its maximum capacity

Hi,
Get this error:
Collection has reached its maximum capacity
Listview related i think ,any suggestions?
0
RIAS
Asked:
RIAS
  • 2
  • 2
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
can you show the relevant code?
how many items did you put in the collection?
0
 
RIASAuthor Commented:
I have not added any collection
the code is here
I am running scripts with 300,000 lines
  If SQL <> "" Then
                    'LockWindowUpdate(frmMain.lstResults.Handle.ToInt32)
                    .lstResults.BeginUpdate()
 
                    With Results
                        If Not Loading Then GoTo stopload 'Stop the load
                        RecAff = 0 'Reset records affected variable
                        .Add(SQL) 'Add SQL line to results window
                        IntResultsCount = .Count - 1
                        'If .Item(IntResultsCount).SubItems.Count > 0 Then
                        .Item(IntResultsCount).SubItems.Insert(1, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, IniFile))
                        'End If
                        'If .Item(IntResultsCount).SubItems.Count > 1 Then
                        .Item(IntResultsCount).SubItems.Insert(2, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, File.Text))
                        ' End If
 
                        ExecSQL.CommandText = SQL
 
                        ExecSQL.Execute(RecAff) 'Execute SQL statement
 
                        .Item(IntResultsCount).SubItems.Insert(3, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, CStr(RecAff)))
                        .Item(IntResultsCount).EnsureVisible()
                        frmMain.lstResults.EndUpdate()
                     
                        'LockWindowUpdate(False)
                        ' frmMain.lstResults.ResumeLayout()
                        'End If 'Update results window with the records affected total
 
                    End With
                End If

Open in new window

0
 
RIASAuthor Commented:
It happens when i rerun the same script
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>I am running scripts with 300,000 lines
you mean, 300K lines in the list?
that's a bit much; you need to redesign that somehow...
0
 
Anurag ThakurTechnical ManagerCommented:
have you read this link onĀ http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_20491940.html  
even this link will also suggest you to redesign the logic

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now