Another vb.net queiry hehe

Discussion in 'Computing, Science, and Technology' started by Gatzy118, Aug 27, 2008.

  1. Gatzy118

    Gatzy118 New Member

    Joined:
    Jan 7, 2008
    Messages:
    350
    Likes Received:
    0
    Device:
    iPod touch
    well. I import a picture to my resources but when i run this code...

    Picturebox1.image = image.fromfile("image.png")

    It says file not found. If i put the picture in the debug folder then it works as that is the current dir. However what do i need to do so it works once published and during debugging?
  2. MountainDew

    MountainDew New Member

    Joined:
    Feb 23, 2008
    Messages:
    194
    Likes Received:
    1
    Device:
    iPod touch
    Try putting the full path. "C:\path\to\image.png"
  3. Gatzy118

    Gatzy118 New Member

    Joined:
    Jan 7, 2008
    Messages:
    350
    Likes Received:
    0
    Device:
    iPod touch
    i cant put the full path because it depends on where the program installs to. I need a relative path but if i put it in a resources folder in the solution explorer i dont know how to embed it
  4. MountainDew

    MountainDew New Member

    Joined:
    Feb 23, 2008
    Messages:
    194
    Likes Received:
    1
    Device:
    iPod touch
    Then this is what I do in VB6, donno if it it's the same for .NET
    Code:
        App.Path & "\picture.png"
    
    App.Path returns the program's directory
  5. micaheljcaboose

    micaheljcaboose Well-Known Member

    Joined:
    Jan 20, 2008
    Messages:
    1,855
    Likes Received:
    82
    Usually I can't get any file recognitions while debugging. So just try to publish what you have already and place the png in there to see if it works.
  6. Gatzy118

    Gatzy118 New Member

    Joined:
    Jan 7, 2008
    Messages:
    350
    Likes Received:
    0
    Device:
    iPod touch
    ive decided to just publish and copy the resources into a folder before creating an installer
  7. hooger

    hooger Banned

    Joined:
    Sep 29, 2007
    Messages:
    419
    Likes Received:
    2
    Lets say it installed to "c:/users/me/blah/"

    and the picture is in "c:/users/me/blah/resources/pic.png"

    Just type:

    Picturebox1.image = image.fromfile("/resources/image.png")

    My vb is a bit rusty, perhaps i should go look at my old work, but that should work...
  8. Gatzy118

    Gatzy118 New Member

    Joined:
    Jan 7, 2008
    Messages:
    350
    Likes Received:
    0
    Device:
    iPod touch
    yeah i got that now but im manually moving the resource folder there. Is there a property inthe build and deploy or publish or even for each resource that will mean it creates another resource folder when publishing?

Share This Page