Random Images with website links
On my form I have the image and in my resource file I have 10 images.
Can someone assist me with my code on how to add the right website link to the right image please, thank you.
Code:
Private Sub PictureBox1_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox1.Click
PictureBox1.Image = My.Resources.Resources.Banner_0
Dim BANNERSTRING As String
Randomize()
BANNERSTRING = "My.Resources.Resources.Banner_" & Int(Rnd() * 1000000) Mod 10
'MsgBox(BANNERSTRING)
'Dim ImgLoad As Bitmap = GetObject(BANNERSTRING)
PictureBox1.Image = My.Resources.ResourceManager.GetObject("My.Resources.Resources.Banner_1")
End Sub
Re: Random Images with website links
Images have a Comment property in which you could store the web address. Alternatively you could use the Name property as an alias and use a dictionary to tie up the alias and the web address or you could simply store the web addresses as Strings in the resources file in the same order as the images and use parallel indexing.
Re: Random Images with website links
Im sorry you completely befuddled the heck out of me repeating yourself there.
Re: Random Images with website links
Just where do I repeat myself?
Option 1: store the relevant web address in each image's .Comment property
Option 2: use a dictionary to translate the image Name to the web address
Option 3: use the resource file to store all the web addresses as string resources