Results 1 to 5 of 5

Thread: Get Folder in My.Resources

  1. #1

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,678

    Get Folder in My.Resources

    In short, I'm wanting to get the path to a folder in My.Resources. In detail, I have a folder in My.Resources that contain a group of images and my idea is to iterate through each file in that folder and create a PictureBox for each file.

    I've tried using the solution here, but when I debug and get the path returned, the directory does not exist. More specifically the code I'm trying to use is this:
    Code:
    Dim myresourcefullPath As String = IO.Path.Combine(IO.Path.GetFullPath(My.Resources.ResourceManager.BaseName), "Smiley")
    What would y'all suggest that I do?

  2. #2
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,570

    Re: Get Folder in My.Resources

    Maybe you could read the XML file in the Debug folder to get the list of (resource) files?

  3. #3
    Member Aggierich's Avatar
    Join Date
    Oct 2011
    Posts
    32

    Re: Get Folder in My.Resources

    Found this, if you trying to find the resource folder for your project's imported resources....

    Code:
     dim fullpath as string = System.IO.Path.GetFullPath(Application.StartupPath & "\..\..\Resources\")

  4. #4
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,712

    Re: Get Folder in My.Resources

    Resources are packed in the assembly and therefore probably aren't accessible that way. You can certainly enumerate all of the resources in the assembly's manifest as done here, (it's in c++) but you would be looking at all of the resources files.

    Quote Originally Posted by Aggierich
    Found this, if you trying to find the resource folder for your project's imported resources....

    Code:
    dim fullpath as string = System.IO.Path.GetFullPath(Application.StartupPath & "\..\..\Resources\")
    That works as long as the executable is in the original build output directory, but it would certainly fail when the app is deployed to any other directory.
    Kevin
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

  5. #5

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