and determine if theyre a file or a folder?
by most efficeint, i mean fastest with least ram needed :) (so no giant controls to add, etc)
and determine if theyre a file or a folder?
by most efficeint, i mean fastest with least ram needed :) (so no giant controls to add, etc)
FindFirstFile, FindNextFile API's.....
Hmm... It really does sound like you're building a trojan from all these questions :|
is there an example without a listview?
just something like debug.print file, type will do :)
and that wont retrieve files :(
anyone have a simple function to retrieve folders/files from a dir?
such as
ListFolders(Folder as String)
ListFiles(Folder as String)
check out "Dir" in VB help, the example should be more than enough for you.
http://mvps.org/vbnet/index.html?cod...umadvanced.htm
You might want to check around that site and not just visit the links I give you. There is a ton of useful stuff for VB there. You will find that using the API is the fastest way to enumerate files and folders. If you want to list all subfolders and their subfolders etc., you will need recursion.
Again, the site there WILL have what you want, but you might have to do a little work to find it.
Conflicting requirements...
Using DIR means no extras, just the VB run time. So this is efficient, but its not necessarily the quickest.
This is the quickest way of adding the files to a listbox:VB Code:
SearchName = "C:\Temp\*.*" f = Dir(SearchName, vbReadOnly) While f <> "" MsgBox f f = Dir() Wend
VB Code:
Private Declare Function SendMessageStr Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long Private Sub Command1_Click() Dim r As Long r = SendMessageStr(List1.hwnd, &H18D, &H20, "C:\*.*") End Sub