-
Tab-Delim' List Items: Count Item & QTY
[Originally posted by JC Peralta]
In VB 6,
I have a Listbox. In the listbox, I have many entries. Each entry represents a SKU and QTY separated by a TAB. I'm using the following Function or Sub, but it's too slow when there are a lot of entries. Please review and see if it can be tweaked so that it computes faster. Please, in your reply, include the revised code.
Thanks.
Current Code:
'Purpose: Computes tab-delimited data (Phrase & vbTab & Value)
Public Sub ComputeSKUQTYField(lstFrom As ListBox, lstTo As ListBox)
* * Dim OuterCounter* * * As Integer
* * Dim InnerCounter* * * As Integer
* * Dim SubTotal* * * * * As Integer
* * Dim Total* * * * * * As Integer
* * Dim SKUPicked* * * * As String
* * Dim SKUInProcess* * * As String
* * Dim LastResults* * * As String
* * Dim Results* * * * * As String
* * For OuterCounter = 0 To lstFrom.ListCount - 1
* * * * lstFrom.ListIndex = OuterCounter
* * * * SKUPicked = GetPhrase(lstFrom.Text)
* * * *
* * * * For InnerCounter = 0 To lstFrom.ListCount - 1
* * * * * * lstFrom.ListIndex = InnerCounter
* * * * * * SKUInProcess = GetPhrase(lstFrom.Text)
* * * * * *
* * * * * * If SKUInProcess = SKUPicked Then
* * * * * * * * SubTotal = GetValue(lstFrom.Text)
* * * * * * * * Total = Total + SubTotal
* * * * * * End If
* * * * Next InnerCounter
* * * *
* * * * Results = SKUPicked & vbTab & Total
* * * *
* * * * If Results <> LastResults Then
* * * * * * lstTo.AddItem Results
* * * * * * lstTo.Refresh
* * * * * * 'This line can be removed for routine use.
* * * * * * 'Must be changed for other applications.
* * * * * * frmSummary.lstDisplay.AddItem Results
* * * * * * frmSummary.lstDisplay.Refresh
* * * * End If
* * * * * *
* * * * LastResults = Results
* * * * SubTotal = 0
* * * * Total = 0
* * Next OuterCounter
End Sub
-
well a simple optimization would be to set the visibility property to false ,, perform your stuff and set the visibility property to true
this will give you a hughe performance boost
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks