Results 1 to 9 of 9

Thread: Popup Menu

  1. #1

    Thread Starter
    Hyperactive Member flame_211's Avatar
    Join Date
    Jun 2000
    Location
    I dont really think I know where I am???
    Posts
    393

    Exclamation 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

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    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:
    1. str = "c:\windows\desktop\*.*"
    2.  
    3. Do While Dir$(str) <> ""
    4.   Load mnuFiles(mnuFiles.UBound + 1)
    5.  
    6.   mnuFiles(mnuFiles.UBound).Caption = Dir$(str)
    7.  
    8.   str = Dir
    9. Loop
    10.  
    11. PopUpMenu mnuPopup

    I think
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    VB Code:
    1. Private Sub Command1_Click()
    2. Dim sFile As String
    3. Dim s As String
    4.  
    5.     sFile = Dir("c:\*.*")
    6.     Do While sFile <> ""
    7.         Load mnuFiles(mnuFiles.UBound + 1)
    8.         mnuFiles(mnuFiles.UBound).Caption = sFile
    9.  
    10.         sFile = Dir
    11.     Loop
    12.  
    13.     PopupMenu mnuPopUp
    14.  
    15. 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

  4. #4

    Thread Starter
    Hyperactive Member flame_211's Avatar
    Join Date
    Jun 2000
    Location
    I dont really think I know where I am???
    Posts
    393
    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

  5. #5
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    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

  6. #6

    Thread Starter
    Hyperactive Member flame_211's Avatar
    Join Date
    Jun 2000
    Location
    I dont really think I know where I am???
    Posts
    393
    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

  7. #7

    Thread Starter
    Hyperactive Member flame_211's Avatar
    Join Date
    Jun 2000
    Location
    I dont really think I know where I am???
    Posts
    393
    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

  8. #8
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    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

  9. #9

    Thread Starter
    Hyperactive Member flame_211's Avatar
    Join Date
    Jun 2000
    Location
    I dont really think I know where I am???
    Posts
    393
    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
  •  



Click Here to Expand Forum to Full Width