-2

I want to add a picture to my program but you need the directory for the picture for that (by my understanding). How do I make the program know where it self is and find the picture that I want to add. Note I can't set the directory to where it is on my computer as I want the program to be usable on other computers.

  • 1
    Unclear to me what you are asking, but you can just add an image into your project's resources and use it. It gets compiled into the exe. – LarsTech Oct 04 '17 at 16:00
  • 1
    It sounds like you either want to use a relative path to a resource (which is easy -- that's what Lars is referring to), or you want your application to discover its own installation path. If that's not the case, please try to explain you requirement in more detail. – 15ee8f99-57ff-4f92-890c-b56153 Oct 04 '17 at 16:00

1 Answers1

0

Have a look at Path.GetDirectoryName(Application.ExecutablePath)

Michael
  • 1,931
  • 2
  • 8
  • 22