CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2009
    Posts
    9

    calling files from resource folder

    HI i need some help in using a picturebox to call pictures out of the resource folder and loop it

    previously i have coded:


    Me.PictureBox1.Image = Image.FromFile(Application.StartupPath + "\\JPG LandoltC\" + filePath + ".jpg")


    where filePath is the function to locate the name of the pictures







    but now i have to put everything into the .exe to make it more "sightly"


    so now
    i'm trying

    Me.PictureBox1.Image = My.Resources.filePath

    and its not working... can someone guide me?

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

  3. #3
    Join Date
    Sep 2009
    Posts
    9

    Re: calling files from resource folder

    the links shows how to call individual files only

    i can get there, but how do i loop it after calling the file?

  4. #4
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: calling files from resource folder

    It's your file, so you know what's in there. No reason for a loop. Just include the code!
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  5. #5
    Join Date
    Sep 2009
    Posts
    9

    Re: calling files from resource folder

    But there is a need for me to loop it.

    its like this.. when the form shows up. it will have to detect the input to see if its right or wrong and loop to the next randomise picture.

    after 5 pics it will have to search for the next level and show the pics again for another 5 time till wrong inputs are detected 3/5times..

    all these were coded in my function getfilepath, but after adding the pics into the resource folder, i have no idea how to call and loop it.

  6. #6
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: calling files from resource folder

    First, load them into an array of some type. Then, you can loop thru it using a MOD 5, which will do what you want. 5 MOD 5 is 0, while 16 MOD 5 is 1
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  7. #7
    Join Date
    Sep 2009
    Posts
    9

    Re: calling files from resource folder

    thanks you

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
  •  





Click Here to Expand Forum to Full Width

Featured