Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. File reference in Visual Basic

File reference in Visual Basic

Scheduled Pinned Locked Moved Visual Basic
csharpdatabasequestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Razanust
    wrote on last edited by
    #1

    I created a reference to a file at some location in the hard drive in a vb.net application.

    db_optb.Image = Image.FromFile("F:\Documents and Settings\Raza\My Documents\My Pictures\quiz_pics\opt_bg_post.jpg")

    The program executed fine. But when i took the whole project folder to another PC and executed it there it gave a 'File does not exist' exception. Definitely the file was not there in this PC. So can place the file in the project and refer it in such a way that taking the project to any other place does not create problems?

    L 1 Reply Last reply
    0
    • R Razanust

      I created a reference to a file at some location in the hard drive in a vb.net application.

      db_optb.Image = Image.FromFile("F:\Documents and Settings\Raza\My Documents\My Pictures\quiz_pics\opt_bg_post.jpg")

      The program executed fine. But when i took the whole project folder to another PC and executed it there it gave a 'File does not exist' exception. Definitely the file was not there in this PC. So can place the file in the project and refer it in such a way that taking the project to any other place does not create problems?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Razanust wrote:

      I created a reference to a file at some location

      That's not a reference, that's loading something from a specific path.

      Razanust wrote:

      So can place the file in the project and refer it in such a way that taking the project to any other place does not create problems?

      Include it as a resource[^].

      Bastard Programmer from Hell :suss:

      S 1 Reply Last reply
      0
      • L Lost User

        Razanust wrote:

        I created a reference to a file at some location

        That's not a reference, that's loading something from a specific path.

        Razanust wrote:

        So can place the file in the project and refer it in such a way that taking the project to any other place does not create problems?

        Include it as a resource[^].

        Bastard Programmer from Hell :suss:

        S Offline
        S Offline
        Simon_Whale
        wrote on last edited by
        #3

        +5, Thats how I'd approach it too

        Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups