I have developed a visual C# windows form application using Visual Studio IDE.
My problem is how to check if the user has selected an image or not.
I roughly check the Image like a String, Integer objects but it does not work
if(myPictureBox.Image == NULL){
//The Image is Null
}
You can do a check like this
bool isNullOrEmpty = myPictureBox == null || myPictureBox.Image == null;
Or you can create your own extension method
public static bool IsNullOrEmpty(this PictureBox pb)
{
return pb == null || pb.Image == null;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.