Domanda

I have 2 images in my Project's Resources and I want to make an If statement to see if a picture box has one, if that happens, I want to change to another image. I have something like this but it does not work:

 If  pic1.BackgroundImage Is Global.images.My.Resources.ima1 Then
 pic1.BackgroundImage = Global.images.My.Resources.ima2
End If

Am I right? or what else can I do to it to get that?

È stato utile?

Soluzione

If  pic1.BackgroundImage = Global.images.My.Resources.ima1 Then
 pic1.BackgroundImage = Global.images.My.Resources.ima2
End If

Altri suggerimenti

    If IsNothing(pic.BackgroundImage) Then
        pic.BackgroundImage = simple.My.Resources.Resources.Winter
    End If
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top