Vb.net help -> ...\folder\file.exe style, paths

If you need help with something which doesn't fit in to another forum section, then post here.

Vb.net help -> ...\folder\file.exe style, paths

Postby Kaelan002 on Sun Dec 11, 2011 6:19 pm

I have an application where the paths of six images are assigned to an array like this:
Code: Select all
path_image(0) = "G:\school\Computing\Programming\Rings_around_the_rose\Dice\1.png"
path_image(1) = "G:\school\Computing\Programming\Rings_around_the_rose\Dice\2.png"
path_image(2) = "G:\school\Computing\Programming\Rings_around_the_rose\Dice\3.png"
path_image(3) = "G:\school\Computing\Programming\Rings_around_the_rose\Dice\4.png"
path_image(4) = "G:\school\Computing\Programming\Rings_around_the_rose\Dice\5.png"
path_image(5) = "G:\school\Computing\Programming\Rings_around_the_rose\Dice\6.png"

The problem is as its on a flash drive and moved around on the school server so the drive letter and path changes, for example it is currently G: but at school it would be H: making the paths invalid.

The program and its assets are stores like this:
\Rings_around_the_rose\bin\debug\program.exe
\Rings_around_the_rose\Dice\1-6.png

I would rather not put the application in \rings_around_the_rose and call the images without the paths as I would have to move the .exe everytime it compiles it to \debug and it would look messy.
Nor can I do = application.startuppath + "\dice\1.png" as that would give = \Rings_around_the_rose\bin\debug\dice\1.png

So how can do the equivalent of this? Or another workaround?
Code: Select all
path_image(0) = .\Rings_around_the_rose\Dice\1.png"
path_image(0) = find.path(Rings_around_the_rose) + "\Dice\2.png"


Full program
--------------------------------------------------
written in vb.net 2010
compiled in visual studio 2010 ultimate
compiled on windows 7 64bit
Last edited by Kaelan002 on Sun Dec 11, 2011 6:59 pm, edited 2 times in total.
There are 10 types of people in the world: those that know binary, those that don't, and those that didn't expect this joke to be in base 3.

[video =373,150]http://a.pomf.se/ixefrf.webm[/video] Now shhhh Kaelan... OOOOOOH
pomf.se is ded. :'(
User avatar
Kaelan002
UKCS Sponsor
UKCS iSeries Attendee
 
Player: Kae
STEAM_0:1:29878923
 
Posts: 2166
Joined: Sun Nov 07, 2010 12:28 pm
Location: The restaurant at the end of the universe



Image

Re: Vb.net help, ...\folder\file.exe style paths

Postby coldandtired on Sun Dec 11, 2011 6:26 pm

If it's only 6 pics why not add them to the program as a resource?
Image
User avatar
coldandtired
UKCS Admin
 
Player: coldandtired
STEAM_0:0:27915503
 
Posts: 3503
Joined: Sun Jan 24, 2010 12:40 pm
Location: 18th Century Europe



Image

Re: Vb.net help, ...\folder\file.exe style paths

Postby ApacheFlame on Sun Dec 11, 2011 6:27 pm

The Programmers Mantra: Declare Variables, not War.

Image
Image
User avatar
ApacheFlame
Exec. Admin (Retired)
Moderator
UKCS iSeries Attendee
 
Player: Apache
STEAM_0:1:27288431
 
Posts: 5300
Joined: Tue Dec 22, 2009 1:12 am
Location: over at the Frankenstein place



Image

Re: Vb.net help -> ...\folder\file.exe style, paths

Postby coldandtired on Sun Dec 11, 2011 6:32 pm

If you really want to keep them outside you need to look at Pack URIs (http://msdn.microsoft.com/en-us/library ... _Authority, for example).
Image
User avatar
coldandtired
UKCS Admin
 
Player: coldandtired
STEAM_0:0:27915503
 
Posts: 3503
Joined: Sun Jan 24, 2010 12:40 pm
Location: 18th Century Europe



Image

Re: Vb.net help -> ...\folder\file.exe style, paths

Postby Kaelan002 on Sun Dec 11, 2011 6:54 pm

Thanks apache, I did try google and the msdn but had no luck as I didn't know what I was searching for. :P
Last edited by Kaelan002 on Sun Dec 11, 2011 7:00 pm, edited 1 time in total.
There are 10 types of people in the world: those that know binary, those that don't, and those that didn't expect this joke to be in base 3.

[video =373,150]http://a.pomf.se/ixefrf.webm[/video] Now shhhh Kaelan... OOOOOOH
pomf.se is ded. :'(
User avatar
Kaelan002
UKCS Sponsor
UKCS iSeries Attendee
 
Player: Kae
STEAM_0:1:29878923
 
Posts: 2166
Joined: Sun Nov 07, 2010 12:28 pm
Location: The restaurant at the end of the universe



Image

Re: Vb.net help, ...\folder\file.exe style paths

Postby Kaelan002 on Sun Dec 11, 2011 6:55 pm

coldandtired wrote:If it's only 6 pics why not add them to the program as a resource?

I wasnt aware that was possible, ill look into it. Thanks. :)
There are 10 types of people in the world: those that know binary, those that don't, and those that didn't expect this joke to be in base 3.

[video =373,150]http://a.pomf.se/ixefrf.webm[/video] Now shhhh Kaelan... OOOOOOH
pomf.se is ded. :'(
User avatar
Kaelan002
UKCS Sponsor
UKCS iSeries Attendee
 
Player: Kae
STEAM_0:1:29878923
 
Posts: 2166
Joined: Sun Nov 07, 2010 12:28 pm
Location: The restaurant at the end of the universe



Image

Re: Vb.net help -> ...\folder\file.exe style, paths

Postby coldandtired on Sun Dec 11, 2011 7:02 pm

If you're using WPF (which you should be :) ) you can find a few examples here: http://stackoverflow.com/questions/3476 ... -resources
Image
User avatar
coldandtired
UKCS Admin
 
Player: coldandtired
STEAM_0:0:27915503
 
Posts: 3503
Joined: Sun Jan 24, 2010 12:40 pm
Location: 18th Century Europe



Image


Return to I need help with...

Who is online

Users browsing this forum: CommonCrawl [Bot] and 0 guests