picturebox image

Enigmatic
06-06-2006, 03:37 PM
Hi folks,

I`m looking to add a picture to represent a text based word [I.E. a pear for the word pear etc ] and I am using the following code :

If (lblReel1.Text = ("Apple")) Then
picBox1.Image = System.Drawing.Image.FromFile _
("images/apple.jpg")
End If

The thing is the picture is not being displayed when lblReel1.Text has the value "Apple".

Anyone got any ideas or resources that could help me ?

Thanks.

AFterlife
06-07-2006, 08:43 AM
Use the String.Compare method to compare 2 strings.

You would use it like this:


If String.Compare(lblReel1.Text, "Apple") = 0 Then
picBox1.Image = System.Drawing.Image.FromFile _
("images/apple.jpg")

End If



0 means the 2 strings are a match. Less then or greater then 0 the strings do not match.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum