I need to find out what is currently hold in PictureBox.Image property and take action as necessary. I tried various things but can't get it work

Compare it with PictureBox which Image is set to null

PictureBox emptyImg = new PictureBox();
emptyImg.Image = null;

//Compare
myPictureBox.Image.Equals((Bitmap) emptyImg.Image)

Compare with existing resources

myPictureBox.Image.Equals((Bitmap) Properties.Resources.blue)

Project builds without any errors but once I run form its kicks meaningless errors.

Recommended Answers

All 2 Replies

I have tried that once but with images in the same picturebox is what i comapared and it worked,
but when i did it with 2 images in different picture boxes, as far as i remember the later didn't work for me either

I just got solution from friend

System.Object.Equals((Bitmap)myPictureBox.Image,(Bitmap)emptyImg.Image)

Problem sorted...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.