Link to home
Start Free TrialLog in
Avatar of Olukayode Oluwole
Olukayode OluwoleFlag for Canada

asked on

How can i point to a default image in my C# application

I have a default image i want to use in C# application

I stored  the default image  in c:\crystal\images\defaultimage.png

I am trying to point to  it in my application as my default image but

somehow pointing  to the file with pbxPhoto.Image = ("C:\Crystal\Images\defaultimage.png");

 gives a syntax error (see attached)

Please note that i am getting the error in the code even before running

How can i resolve this error
ImagePath230319.PNG
Avatar of Tapan Pattanaik
Tapan Pattanaik
Flag of India image

what error you are getting ?
Avatar of Olukayode Oluwole

ASKER

If you look at the attached file you will see the  slash character between the folders

being flagged.

This is more like a syntax error and of course i cant run with the error

Regards

Olukay
ASKER CERTIFIED SOLUTION
Avatar of it_saige
it_saige
Flag of United States of America image

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
either use your appsettings or copy the image to your source directory and then use a relative path from there
https://www.youtube.com/watch?v=fzfztjaqR18
I have tried both options with the 2 statements

pbxPhoto.Image = Image.FromFile("C:\\Crystal\\Images\\defaultimage.png");
pbxPhoto.Image = Image.FromFile(@"C:\Crystal\Images\defaultimage.png");

I got the same error  File not Found (see attached)

User generated image
Even though the file exists.

What could I be doing wrong

Olukay
Thanks for the effort.
I would have loved to listen to the UTube video but there is no voice

Regards