I am attempting to write a simple search routine, but for some reason the FindFirstFile api call always returns a -1 (no files found, or error), and I can't figure out why. Can someone please help me spot my mistake? Thanks.
Code:Dim hsearch As Long Dim findinfo As WIN32_FIND_DATA Dim success As Long Dim buffer As Long Dim retval As Long FileAndPath = Path & FileName hsearch = FindFirstFile(FileAndPath, findinfo) If hsearch = -1 Then frmMain.Caption = "No Files Found" Exit Sub End If Do buffer = Left(findinfo.cFileName, InStr(findinfo.cFileName, vbNullChar) - 1) cboFileList.AddItem buffer success = FindNextFile(hsearch, findinfo) Loop Until success = 0 retval = FindClose(hsearch)





Reply With Quote