lisbox1.additem error

Discussion in 'AutoCAD' started by Matthew, Jan 16, 2004.

  1. Matthew

    Matthew Guest

    at the second to the last line I get the error "expected variable of
    function" & Additem is highlighted. I would like to populate a listbox with
    a list of files.. What is wrong with this?

    ** snippet
    Dim tmp As String
    Dim fileList As New Collection
    Dim fi As Scripting.file
    Dim fldr As Scripting.folder
    Dim Cnt As Single
    Dim xx As Variant
    Dim itm As Variant

    Cnt = 0

    If fso.FolderExists(FullPath) Then
    Set fldr = fso.GetFolder(FullPath)
    End If

    For Each fi In fldr.Files
    tmp = UCase(Right(fi.Name, Len(FileType)))
    If tmp = UCase(FileType) Then 'nme = fi.Name 'xx =
    Main.ListBox1.AddItem(nme, Cnt)
    fileList.Add fi.Name, fi.Name 'Me.ListBox1.List = fileList
    End If 'add files to listbox1
    Next 'MsgBox FullPath, vbOKOnly, FolderName

    For Each itm In fileList
    Cnt = Cnt + 1
    Me.ListBox1.AddItem(itm, Cnt)
    Next

    ** snippet


    Thanks
    Matthew
     
    Matthew, Jan 16, 2004
    #1
  2. loose the ( )
     
    Jorge Jimenez, Jan 16, 2004
    #2
  3. Matthew

    Matthew Guest

    Thanks for the tip. The list box is still not populated with the list of
    file names. ??

    Thanks
    Matthew
     
    Matthew, Jan 16, 2004
    #3
  4. Matthew

    Matthew Guest

    I'm an idiot.. I now have the columncount property set to 1 so I can see
    the list...

    Thanks
    Matthew
     
    Matthew, Jan 16, 2004
    #4
  5. I'm not going to argue with you.
     
    Jorge Jimenez, Jan 16, 2004
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.