|
Visual Basic (VB and VBA) |
|
Copyright 1999-2001 Christopher Greaves. All rights reserved. Home Page and email to [email protected] |
| If in doubt, record a macro and inspect the entrails! |
Please read the DISCLAIMER.
Here is an INDEX to all the procedures.
You will probably need one copy of my GLOBAL DECLARATIONS.
Public Function LoadUniqueArrayToListBox(strAr() As String, cmb As ComboBox)
' Procedure : LoadUniqueArrayToListBox
' Description: Load only unique items from the array to the listbox.
' By: Chris Greaves Inc.
' Inputs: String array, ListBox, integer Column number.
' Returns: None.
' Assumes: Nothing
' Side Effects: None
' Tested: By the calls shown below.
' Sort the array
Call QSort(strAr, 0, UBound(strAr, 1), False)
' Read back the array; clear the listbox and drop duplicate (sorted) entries.
Dim strOld As String
cmb.Clear
Dim lngRow As Long
For lngRow = 0 To UBound(strAr)
If UCase(strOld) = UCase(strAr(lngRow)) Then ' found a duplicate on this column-key
Else ' Not a duplicate; copy it back to the list.
strOld = strAr(lngRow)
cmb.AddItem strOld
End If
Next lngRow
End Function
| We all knew nothing when we started … |
|
Home Page and Contact Information Send email to [email protected]. This page was last updated Thursday, November 15, 2001 |