1
Answer

To provide image path in winforms application

Chetan Navale

Chetan Navale

12y
3.2k
1
Hi,
I am creating an windows forms application, in which I wish to give image path to button to change its image on an event. I have tried doing it in the way below:
btnSave.Image = Image.FromFile(@"..\Images\Buttons\updateblkbutton.png");
while compiling it wont gives me any error but when I run it it will terminate giving an error of filenotfoundexception. Here Images is the folder inside my application folder. When I provide hard path (Full path along with Drive name and all folder names) insted of thoes dots it will run without any erros.
Can some let me know what should I need to change in the above line so that it will run correctly.



Answers (1)
Next Recommended Forum