Accessing Relative Image Locations

  • Thread starter Thread starter David
  • Start date Start date
D

David

Hi,

I am attempting to write a C# photographic gallery. I wish to create a
standard application that will cycle through all images placed inside a
folder that is relative to the executable. The reason for this is so that I
can simply add/remove photographs from the directory without having to
re-compile. Does anyone know how to access images/files from a directory
relative to the application executable.

Many Thanks,
David.
 
All you need to do is determine the location of your application (using, for
instance, Application.StartupPath) and concatenate it using the Path.Combine
method with the relative path to your images.

Once you have the absolute path, then you can do whatever you want.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top