Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to view image from application's path?

Status
Not open for further replies.

vcharles

IS-IT--Management
Jun 29, 2004
21
0
0
US
Hello,

Currently I have to hard code the path of my image files in order to view them from crytal report 2008, is there a way to replace the hard code string with the application's path, in order to give users the flexibility to install the program to the folders of their choice.

Thanks,

Victor
 
If the image is in the same folder as your application or a subfolder and the shortcut to the application has it running in the same folder as where it's installed, you might be able to use a relative path in the format ".\image file name" or ".\subfolder name\image file name"

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
I tried ".\image file name" but it still doesn't work.

Victor
 
Did you do it without the quotes and replacing "image file name" with the actual name of the image file?

If that didn't work then you may want to try using an environment variable to store the path to your application and use that as the path to the reports. You would reference it as %MyAppDir%\<image file name>. If that works, you would need to see if the installer for your application will set up the environment variable for you based on where the application is being installed.

Another option would be to store the path in a table in the database. Your application would have to allow the user to set that value. Then use the table in your report to get the image path.

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Dell,

I'm not certain of your explanation, what do I declare MyAppDir% as and where do I declare it?

Can you please send me an expample if the last option?

Thanks,

Victor

 
Hello,

I noticed that I am able to see the image files using ".\image.png" (Without the quotes) using Crystal reports IX alone; However when I include the report in my VS 2008 project, I am no longer able to see the images, any ideas what is causing the problem?

Thanks,

Victor.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top