Results 1 to 4 of 4

Thread: Random Images with website links

  1. #1

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    Exclamation 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

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    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.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  3. #3

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    Re: Random Images with website links

    Im sorry you completely befuddled the heck out of me repeating yourself there.

  4. #4
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    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
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width