Select to view content in your preferred language

Query and return image list

880
2
06-02-2010 12:24 PM
JayKappy
Frequent Contributor
I have some code that allows the user to select a point in the map and it opens a form and displays the appropriate attributes from that feature.
What I want to do now is grab the Unique ID of that point (which I already have) and query a folder (Local or network)to retireve all the images that have that Unique ID in their name.  I then want to take that list and drop it in a ComboBox and a Listbox (want both to later decide which works better).

Say I click point 343....
The images are in a folder as such Image1_343.jpg, Image2_343.jpg

So I query the 8th through 10th character, or a wildcard for the images.
I then need to populate the list box and combobox.

Populating the listbox and combobox is where I am confused....

The next step is to display the image in the form when the user selects from the Listbox or combobox.  (step 2)

Any thoughts or direction?
0 Kudos
2 Replies
JayKappy
Frequent Contributor
..........................................
0 Kudos
JayKappy
Frequent Contributor
I think I am getting closer but cant figure out how to look for a specific jpg...in this example I am looking for a Filetype = "ESRI ArcMap Document".
I can get this to to work with ESRI map document but cant figure out how to change that line to look for jpg files...

I need "*" & variable & ".jpg"

       
   Dim fso, theFolder, f1, fileCol, S
    Dim folderName As String
    Dim theFileType As String
    Dim curFile As String
    
    ' In order to search for specific file types, you need to evaluate
    ' the files collection for files with a specific file description.
    ' This description can be found within Windows Explorer under the
    ' "Type" column
    
    theFileType = "ESRI ArcMap Document" 'Add Type description here
    folderName = "S:\GIS_Data\Users\Engineering\Projects\2010_PROJECTS" 'Add your path here

    Set fso = CreateObject("Scripting.FileSystemObject")
    Set theFolder = fso.GetFolder(folderName)
    Set fileCol = theFolder.Files
    
    For Each f1 In fileCol
          curFile = f1.Name
          If f1.Type = theFileType Then
             'Enter custom code here
             Dim File2 As String
             File2 = curFile
             
            frm_Outfalls_Images.ListBox1.AddItem (File2)

          End If
    Next
          
    'MsgBox File2

        
    frm_Outfalls_Images.Show

0 Kudos