Tab-Delim' List Items: Count Item & QTY


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Tab-Delim' List Items: Count Item & QTY

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    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

  2. #2
    Join Date
    Aug 2004
    Location
    Europe , Netherlands , Rotterdam
    Posts
    69
    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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center