I have image paths stored in my database under the Image column in format Images\ac.jpg. The path is already stored in the text box with the name txtImage.Text. I try to display it in a control, but I get the following error:
Images\ac.jpg
txtImage.Text
An unhandled exception of type "System.IO.FileNotFoundException" occurred in System.Drawing.dllAdditional Information: Images \ ac.jpg
An unhandled exception of type "System.IO.FileNotFoundException" occurred in System.Drawing.dll
Additional Information: Images \ ac.jpg
pbImage.Image = System.Drawing.Image.FromFile(txtImage.Text);
PictureBox. Images\ac.jpg . , C:\Images\ac.jpg
PictureBox
C:\Images\ac.jpg
"" , , .
string absolutePath = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), @"Images\ac.jpg"); pbCoffeeImage.Image = System.Drawing.Image.FromFile(absolutePath);
, FileDialog, , .
FileDialog
Images\ac.jpg - , . , (workingPath\Images\ac.jpg) . , "" .
workingPath\Images\ac.jpg