VB 2010 Setup project - 3 questions

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Ive got a few issues with creating setup programs for 2 apps that I have written. Im not a stranger to VB, but not too experienced either. I am teaching myself and reading books. I have a pretty good understaing of how to write
code in VB 2010.
I know how to set default folders in code, and would prefer to use the "all users" or "public" documents folders to add my supplemental files, but the setup project does not offer that option. It only offers the current users folder options.
In the setup project, I have tried to create custom folders, but again theres no options for ALL USERS or PUBLIC folders, nor the ability to create a custom path to install certain files.
For my first VB10 project, I have written a trivia quiz type game, and installed about 20 quiz files into the application folder under a Game FIles folder. The files are opened / saved in these folders without issues via open / save dialog boxes.
I have set up many settings for the program through the apss properties / settings form. One of the properties is FileLocation. When the first form loads, I check the FileLocation setting, if it is blank, I set the FileLocation setting to My.Application.Info.DirectoryPath
& "Game Files", the I save the settings.
If loading a file the open file dialog will display the correct directory. However, when the options form is displayed, i have a label control which is supposed to display the default file path. Instead of displaying the actual path, it displays
the number "5". I also have a button to change the location, which displays a folder browser dialog, but the dialog opens with the topmost folder selected (Desktop), and the user must browse to the correct location.
Question 1) Since the setting for FileLoaction is saved at first run, how can I display the path properly in the label control, and how can I set the selected folder in the folder browser so the correct folder is selected when it is displayed?
Question 2) How can I set the FileLocation in the settings in the project properties? The setting is in the settings option, but is currently blank as I am unsure if I could type somethng similar to the hardcoded file path (My.Application.Info.DirectoryPath
& "Game Files")
The second app I wrote is a jumble type game which uses three types of game files. The dictionary file is installed under the application directory is and is only read, not written to, so that works ok. The other files are read and written to
and will not work in the app directory under a "files" folder. They are opened via an open dialog, but saved automatically without the use of a save file dialog. I can use them OK when debugging, but if the files are installed as part of the
setup package, the files cannot be written to when the app runs as an error is raised that the files cannot be written to. So I compromised and installed the other 2 files into the users My Documents folder under a sub-folder. One file is opened
and saved automatically, nouser intervention and the other file is opened via the open file dialog, but then saved automatically to the place it was opened from.
Question 3) Is it possible to specify custom folders to install files to? For 1 app, I would like to install the puzzle files under the C: drive in a folder with the application name so it would be available to all users, or at least to the all users
documents folder in a sub-folder with the app name.
Im rambling here, but its late, and I couldnt find the answers using VS help, or google searches. Im hoping someone will be able to assist. Thank you.

View the full article
 
Back
Top