dcsimg
Results 1 to 4 of 4

Thread: Make the VB not be dependant on source folder

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2019
    Posts
    8

    Make the VB not be dependant on source folder

    Hi

    its the old man again, after gettting some great help last time ive come back with another question.

    Ive created a 5 button box and when I click any of them it launches a program from a folder on my HDD located in user\download\tools.

    When I build the exe it needs to have the folder located at user\download\tools to run but I dont want that, I want to be able to send just the EXE file to someone and when they click any of the buttons it runs the relevant program (all programs are currently either a batch script or another VB box)

    I guess im after a kind of standalone EXE that has been built with all the needed files compiled into the EXE.

    Is it possible and thanks in advance for the help

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    22,431

    Re: Make the VB not be dependant on source folder

    If you don't know the location of a program, you can't run them...
    You could distribute the apps with your exe. Look into My.Resources to store the apps within the exe, then IO.File.WriteAllBytes to put the apps in the correct location on the target computer...

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    22,431

    Re: Make the VB not be dependant on source folder

    You can't run an app that is encapsulated in My.Resources. VB sees the app as a byte array, so you need to recreate the file on disk, from the byte array...

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,754

    Re: Make the VB not be dependant on source folder

    We see misguided questions like this a lot. You can put those other files wherever you want. If you put them in the same folder as your EXE then you can use Application.StartupPath to get the folder path and the actual location is irrelevant. You can put them in a standard Windows location and use Environment.GetFolderPath or My.Computer.FileSystem.SpecialDirectories to get the actual path at run time. If you want to just deploy a single file then put your EXE and the other files into a ZIP file. People have been doing that for decades.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width