list files in listview box

Mantiza
07-31-2002, 05:29 PM
I'm trying to list the files from a dir in a listview box. I need two columns ("original file name" and "new file name"). the code i have is:

Private Sub file1_click()

For s = 0 To File1.ListCount - 1
ListBoxOldName = File1.Path & "\" & File1.List(s)
ListBoxNewName = Dir1.Path & "\" & Format$(FileDateTime(ListBoxOldName), "yyyy" + "-" + "MM" + "-" + "dd" + " " + "hh" + " " + "mm" + " " + "ss") & ".jpg" 'error 53

ListView1.ListBoxOldName.Add , , Adodc1.Recordset.Fields("OldName").Value
ListView1.ListBoxNewName.Add , , Adodc1.Recordset.Fields("NewName").Value

Next s

End Sub

...When i run the program i get the error "method or data member not found" I am not sure what i am doing wrong. Do I have to set the viewlistbox to multicolumn in the properties?

d_hadzima
07-31-2002, 06:40 PM
You will get that error becuase the ListView control does not have a method called ListBoxNewName or ListBoxOldName.

If you want two columns you need to go into the properties of the Listview control and insert a column.

You can then use the following two lines to add to the listview where is an index and temp is a unique key.

Good luck with it


Call lstvwNotes.ListItems.ADD(i, temp, ListBoxNewName)
lstvwNotes.ListItems(i).SubItems(1) = ListBoxOldName

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum