In my adding_form, I using this code to browse image from its project bin to display as customer picturebox background. I run project in design it is working as well, but after publishing as an .exe file and install to the local computer or different computer it doesn't browse this bg any more.
private void loadimage()
{
try
{
string path = Environment.CurrentDirectory + "\\image\\bguser.png";
if (File.Exists(path))
{
piccustomer.Image = null;
this.piccustomer.Image = System.Drawing.Image.FromFile(path);
}
}
catch (SqlException ex)
{
MessageBox.Show(ex.ToString());
return;
}
}
After inserting the data successfully, it follows with cleartext()
@it is the method to clear all texts. And I put this to clear picturebox and load bg again.
piccustomer.Image = null;
loadimage();
but the loadimage()
is not working.
What is wrong?