OK...I got a question...
I want VB to get all the files in a directory like...
c:\windows\desktop
after it finds all of the files i want it to add all of them to a popup menu
any help???
-Andrew
Printable View
OK...I got a question...
I want VB to get all the files in a directory like...
c:\windows\desktop
after it finds all of the files i want it to add all of them to a popup menu
any help???
-Andrew
In the Menu Editor, add a menu, and a submenu. Set the Index of the submenu to 0. Call the subMenu mnuFiles
Then...
VB Code:
str = "c:\windows\desktop\*.*" Do While Dir$(str) <> "" Load mnuFiles(mnuFiles.UBound + 1) mnuFiles(mnuFiles.UBound).Caption = Dir$(str) str = Dir Loop PopUpMenu mnuPopup
I think
:)
VB Code:
Private Sub Command1_Click() Dim sFile As String Dim s As String sFile = Dir("c:\*.*") Do While sFile <> "" Load mnuFiles(mnuFiles.UBound + 1) mnuFiles(mnuFiles.UBound).Caption = sFile sFile = Dir Loop PopupMenu mnuPopUp End Sub
Little edit, seeing as how my other code didn't work.
:rolleyes:
little problem... i cant get it to show files in the folder...
it just has the submenu show up and thats it...
So the menu is empty, except for the one blank menu? Are you sure there are files in the folder?
i guess it probably because I didnt leave it blank... but now it doesnt know what UBound means or something...
Any one know how to do it? Cause the code that you gave me doesnt have any bugs except that UBound thing...
Did you make sure to give mnuFiles an Index of 0? Because the code works on the assumption that mnuFiles will be a control array.Quote:
Originally posted by flame_211
Any one know how to do it? Cause the code that you gave me doesnt have any bugs except that UBound thing...
Thank you sooooooooo much... I guess I forgot to make it index:0 i had it then I closed it and must have forgotten to do it again.... thanks...