Link to home
Start Free TrialLog in
Avatar of schenkp
schenkp

asked on

File Location Code

Hi,
What code would I use if I wanted a picturebox to be populated with image that by default should be in the following path:

C:\Program Files\Application X\Images

But lets say the user installs the program to

C:\Program Files\Application B\Images

I guess what I am trying to ask is what code can i use so that no matter where the user installe the program the image file is always being pulled one level below the root application?

I have been play around with the following code and I am stilll having issues with it.

ResultantImage.Image = Image.FromFile(@"..\\..\\SnowFlake001.bmp");

Thanks

Peter
ASKER CERTIFIED SOLUTION
Avatar of Expert1701
Expert1701

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of theGhost_k8
app.path will give u current exe path
do whatever thereafter
sorry its this:

AppDomain.CurrentDomain.BaseDirectory
or
Application.StartupPath()