Results 1 to 4 of 4

Thread: Displaying Picture from Google Images into Picturebox using httpwebrequest ~ error

  1. #1

    Thread Starter
    Hyperactive Member simpleonline1234's Avatar
    Join Date
    Mar 2010
    Posts
    322

    Displaying Picture from Google Images into Picturebox using httpwebrequest ~ error

    Hey guys/gals I have an app where I want to be able to view an image into a picture box by entering the URL of the image.

    I keep get error of:



    Here is my code:

    Code:
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    
            Dim request As Net.HttpWebRequest = DirectCast(Net.HttpWebRequest.Create("http://www.google.com/imgres?q=how+to+make+pizza&um=1&hl=en&sa=N&biw=1152&bih=662&tbm=isch&tbnid=wPjdN6FblAIplM:&imgrefurl=http://italianfood.about.com/od/breadspizza/ss/pizzaovn_2.htm&docid=6hmsagY8r4juxM&imgurl=http://0.tqn.com/d/italianfood/1/0/9/E/doughbls.jpg&w=400&h=300&ei=VSmgTua3FMPk0QH4uN20BA&zoom=1&iact=rc&dur=31&sig=115939356797183712562&page=1&tbnh=132&tbnw=177&start=0&ndsp=15&ved=1t:429,r:3,s:0&tx=60&ty=129"), Net.HttpWebRequest)
            Dim response As Net.HttpWebResponse = DirectCast(request.GetResponse, Net.HttpWebResponse)
            Dim img As Image = Image.FromStream(response.GetResponseStream())
            response.Close()
            PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
            PictureBox1.Image = img
    
    
        End Sub
    End Class
    Any idea on why this doesn't work?

    If I use this address it works but nothing else....

    http://www.google.co.uk/intl/en_uk/images/logo.gif
    Are you down with OOP?

  2. #2
    Member
    Join Date
    Oct 2011
    Posts
    61

    Re: Displaying Picture from Google Images into Picturebox using httpwebrequest ~ erro

    SAVE ALL in this project and DEBUG it and then try to open DEBUGed file EXE

    I think it will not give yyou errors...

  3. #3
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Displaying Picture from Google Images into Picturebox using httpwebrequest ~ erro

    The problem is, your link is not just outputting an image, instead a webpage with the requested image in a jQuery popup or something like that.

    If you used this link: http://0.tqn.com/d/italianfood/1/0/9/E/doughbls.jpg
    It would have given you the image !


    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  4. #4

    Thread Starter
    Hyperactive Member simpleonline1234's Avatar
    Join Date
    Mar 2010
    Posts
    322

    Re: Displaying Picture from Google Images into Picturebox using httpwebrequest ~ erro

    The problem is, your link is not just outputting an image, instead a webpage with the requested image in a jQuery popup or something like that.

    If you used this link: http://0.tqn.com/d/italianfood/1/0/9/E/doughbls.jpg
    It would have given you the image !
    Works like a charm!!!! Thanks

    Yeah I didn't think about the whole page trying to load..makes since now that I think about it!!!..

    Thanks guys for the help.
    Are you down with OOP?

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