-
Mar 8th, 2002, 09:15 PM
#1
Thread Starter
Hyperactive Member
Popup Menu
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
Reach me at:
AIM: FlameWide
AIM: Itz deep6
MSN/Email: flame_gandalf@hotmail.com
Check out these sites:
My Blog
-
Mar 8th, 2002, 09:20 PM
#2
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
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 8th, 2002, 09:36 PM
#3
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.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 8th, 2002, 10:29 PM
#4
Thread Starter
Hyperactive Member
little problem... i cant get it to show files in the folder...
it just has the submenu show up and thats it...
Reach me at:
AIM: FlameWide
AIM: Itz deep6
MSN/Email: flame_gandalf@hotmail.com
Check out these sites:
My Blog
-
Mar 8th, 2002, 10:31 PM
#5
So the menu is empty, except for the one blank menu? Are you sure there are files in the folder?
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 8th, 2002, 10:48 PM
#6
Thread Starter
Hyperactive Member
i guess it probably because I didnt leave it blank... but now it doesnt know what UBound means or something...
Reach me at:
AIM: FlameWide
AIM: Itz deep6
MSN/Email: flame_gandalf@hotmail.com
Check out these sites:
My Blog
-
Mar 9th, 2002, 03:49 PM
#7
Thread Starter
Hyperactive Member
Any one know how to do it? Cause the code that you gave me doesnt have any bugs except that UBound thing...
Reach me at:
AIM: FlameWide
AIM: Itz deep6
MSN/Email: flame_gandalf@hotmail.com
Check out these sites:
My Blog
-
Mar 9th, 2002, 04:33 PM
#8
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...
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.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 10th, 2002, 04:58 PM
#9
Thread Starter
Hyperactive Member
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...
Reach me at:
AIM: FlameWide
AIM: Itz deep6
MSN/Email: flame_gandalf@hotmail.com
Check out these sites:
My Blog
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
|