Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 180
  • Last Modified:

How To Make An Install Program

I have created a visual basic program that rely's on an access database and a text file located in a specified location. The location is specified in the code.

My questions are:

1.) Can i create an install program like you use with professional programs that will place my access and text file in the location i have specified in the code.

2.) i want this install program to install the program and place it on the desk top so that when its run the access file and text file are in the proper locations so the program can run error free.

1 Solution
All this can be done using Package and Deployment Wizard (Start - Programs - Microsoft Visual Studio - Tools - Package & Deployment Wizard).
One suggestion, the desktop folder isn't likely to be in the same location on everyone's computer, especially if the user is using windows 2000 or xp.

In win 9x the folder was always "C:\windows\desktop", but in windows 2000 and xp, the folder is something like this:
     "C:\Documents and Settings\Username\Desktop"

One thing you could do is either place the database file in the same folder as the program and use the App.Path variable to get the name of the folder your program is currently stored in:

     Dim strPath as string
     strPath = App.Path & "\dbName.mdb"

But if you want it saved on the desktop, for Windows 2000, XP, and I think NT, you can use something like this to get the location of the desktop folder:

     Dim strPath as string
     strPath = Envoron("userprofile") & "\Desktop\dbName.mdb"
sorry that last bit of code should be this:
    Dim strPath as string
    strPath = Environ("userprofile") & "\Desktop\dbName.mdb"
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

I bet that you can have an installer up and running in less than an hour.

there is a freeware installer called innoSetup that will manage your program install directories, icons, and even registry settings.  see http://www.jrsoftware.org/isinfo.php for information and help files.  It look professional and will create desktop icons, as well as quicklaunch or tray icons for your application.

innoSetup uses a text file to run a compiler that makes up the installer program.  You can change the look and feel as well as installer options.  (I'll add my .iss setup file to this comment later from my other computer where I have my example, so you can see how it easily manages the setup).

For me anyway, I found this really easy to use, as it separates the installer issues from the program created.  If need be, you can also setup different ways depending on the operating system, or application requirements.  

For example: if your code depends on certain programs already installed, like Access, the installer can check before installing your application that the user has it on the computer.  This prevents user errors and will save you any tech support headaches.

Another example: maybe you need registry settings but they differ depending on the variant of Windows used.  innoSetup can make a single installer manage the changes for the specific version of Windows.

Added benefit: Although hardcoding is a no-no, you can of course do so if you want to.  However, by using installers like this one, you end up programming in a more modular manner so that the installer takes care of all of the local file issues rather than hardcoding it in your application.  This will make future code editing easier.

greg222Author Commented:
The package and deployment wizard looks good. Will that place my file where i specify?

yes it will.  In one of the final steps of the package wizard, it will give you a list of files included with the setup program and where they will be installed.
you can change where the files will be installed at that point.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now