|
-
Apr 28th, 2021, 11:56 PM
#1
Thread Starter
Addicted Member
Vb6 List folder and icons into a listbox
hello friends I managed to list the files of the current directory and even "browse" through a textbox thanks to the tip from the friend above but I couldn't find a way to list folders and if possible also some way to put an image in front of the program name even if it was just one, see how it looks and the code :
https://imgur.com/a/fML1zZp
Source:
Dim NameFile As String, SubDir As String, udir As String
Private Sub Form_Load()
'SubDir = CurDir$ & "*.*" ' Change CurDir to whatever directory is being searched
SubDir = udir & "*.*" ' Change CurDir to whatever directory is being searched
NameFile = Dir$(SubDir)
Do While NameFile <> vbNewstring
List1.AddItem "[icon]" & NameFile
NameFile = Dir$
Loop
End Sub
Private Sub Text1_Change()
udir = Text1.Text
List1.Clear
SubDir = udir & "*.*" ' Change CurDir to whatever directory is being searched
NameFile = Dir$(SubDir)
Do While NameFile <> vbNewstring
List1.AddItem "[icon]" & NameFile
NameFile = Dir$
Loop
End Sub
-------------------------------
But I still need to see folders and if there is a way to put an icon or create several pictureboxes by code and put the front, I will be grateful.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|