ok...i'm using this code to populate a list box with files from a certain directory:
is there anyway to make sure that only files with a certain extention show up in the box? thanks for your help.Code:Private Function Dir2(ByVal Path As String) As Variant 'function for listing the skin names in the listbox Dim aList() As String Dim sDir As String Dim iIndex As Long If Right$(Path, 1) <> "\" Then Path = Path & "\" 'List Directories Only sDir = Dir(Path, vbNormal) While Len(sDir) ReDim Preserve aList(iIndex) aList(iIndex) = sDir iIndex = iIndex + 1 sDir = Dir Wend Dir2 = aList End Function Private Sub Form_Load() 'start function for listing the skin names in the listbox Dim aDir As Variant Dim i As Long aDir = Dir2(frmMain.txtPath.Text) For i = 0 To UBound(aDir) frmMain.lstBitmaps.AddItem aDir(i) Next 'remove the first 2 items: "." and ".." frmMain.lstBitmaps.RemoveItem (0) frmMain.lstBitmaps.RemoveItem (0) End Sub




Reply With Quote