0

To let you know, I'm using the visual basic winform coding.

AND I'm using visual studio community 2015.

I know how to use the "if" command like this:

If TextBox1.Text = "hi" Then
  Label1.Text = "TEST"
End If

I also know I can have ifs with ifs inside them

If RadioButton1.Checked = True Then
  If Label1.Text = "hi" then
    Label2.Text = "TEST"
  End If
End If

but when I try to use it with picturebox's it doesn't work:

If PictureBox1.ImageLocation = "C:\blok\grass.png" Then
  Label1.Text = "TEST"
End If

when the program runs, it ignores it, is there an alternative way to do this?

UPDATE 1.1

so, to let you know, somebody told me there was no picturebox1.imagelocation, but if that's the case, then how does this work:

    if label1.text = "TEST" then
picturebox1.imagelocation = "C:\users\TEST\destop\TEST.png"
    end if

so yeah.... theres the first update. also to edit this I had to reset my password, luckly I wrote it down so I can remember.

UPDATE 1.2

don't worry, I figured it out! it goes like this:

public class form1
dim IMAGE as integer = 1
private sub button1_click(sender As Object, e As EventArgs Handles)  button1.Click
if IMAGE = 1 then
picturebox1.imagelocation = "C:\TEST.png"
end if
end sub
end class

1 Answers1

0
public class form1
dim IMAGE as integer = 1
private sub button1_click(sender As Object, e As EventArgs Handles) button1.Click
if IMAGE = 1 then
picturebox1.imagelocation = "C:\TEST.png"
end if
end sub
end class

by doing this, when you click the button, it will show the picturebox.