-3

I am trying to get a messagebox if my picturebox is empty.

if (dial == DialogResult.Yes)
{
    if (openfile.FileName == string.Empty)
    {
        MessageBox.Show("Please Upload Poster");
    }
    else
    {
        this.Close();
        poster = openfile.FileName;
    }

}
Captain
  • 113
  • 2
  • 9

2 Answers2

3
if (pictureBox1.Image != null)
{
    Common.MessageBoxUtilities.WarningMessageBox("You Have Image");
}
else if (pictureBox1.Image == null)
{
    Common.MessageBoxUtilities.WarningMessageBox("You Dont Have Image");
}

Try something like this?

source: http://www.codeproject.com/Questions/677961/How-To-Check-PictureBox-Control-has-image-or-not

0

try it this way:

 if(myPictureBox.Image == NULL)
{
    //MessageBox
}
Dennis
  • 13
  • 1
  • 6
  • 1
    How will this be a difference? Just asking, not flaming –  Sep 25 '15 at 08:25
  • http://stackoverflow.com/questions/151472/what-is-the-difference-between-string-empty-and-empty-string http://stackoverflow.com/questions/263191/in-c-should-i-use-string-empty-or-string-empty-or – Daniel Abou Chleih Sep 25 '15 at 08:27
  • I've been reviewing your answer, it's an automatic resposne. The question was rather poor, but you've just pasted single `if` statement with no explanation whatsoever. – Tarec Sep 25 '15 at 09:38