Results 1 to 15 of 15

Thread: Displaying Image From WebBrowser Onto PictureBox

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2010
    Posts
    7

    Displaying Image From WebBrowser Onto PictureBox

    I'm trying to do this : http://www.vbforums.com/showthread.php?p=3754316

    But using VB.Net instead of VB6.

    I run into a problem with WebBrowser1.Document.Body.createcontrolrange()

    Thanks for the help.

  2. #2

    Thread Starter
    New Member
    Join Date
    Aug 2010
    Posts
    7

    Re: Displaying Image From WebBrowser Onto PictureBox

    bump

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2010
    Posts
    7

    Re: Displaying Image From WebBrowser Onto PictureBox

    bump

  4. #4
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: Displaying Image From WebBrowser Onto PictureBox

    what code have you currently got?

    hint:

    you need to obtain the image path and use a Stream to read it and then read from stream using the Image class, finally setting the Picturebox Image property to that image object.

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  5. #5
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: Displaying Image From WebBrowser Onto PictureBox

    Be sure to import the System.IO namespace and System.Net namespace

    C#:

    Code:
    WebRequest r = WebRequest.Create("http://websitehere.com/picture.jpg");
    HttpWebResponse response = (HttpWebResponse)r.GetResponse();
    Stream st = response.GetResponseStream();
    this.pictureBox1.Image = Image.FromStream(st);
    VB.NET:

    Code:
    Dim request As WebRequest = WebRequest.Create("http://websitehere.com/myimage.jpg")
    Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)
    Dim st As Stream = response.GetResponseStream()
    Me.PictureBox1.Image = Image.FromStream(st)

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  6. #6

    Thread Starter
    New Member
    Join Date
    Aug 2010
    Posts
    7

    Re: Displaying Image From WebBrowser Onto PictureBox

    I have already tried using WebRequest but I can't use that method because the image expires after it is already viewed once(On WebBrowser) so I need to extract it directly from whats already loaded. Thanks.

  7. #7
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: Displaying Image From WebBrowser Onto PictureBox

    i dont understand what you mean by the image expires already? Care to elaborate?

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  8. #8

    Thread Starter
    New Member
    Join Date
    Aug 2010
    Posts
    7

    Re: Displaying Image From WebBrowser Onto PictureBox

    Basically the image is a Captcha, after it loads the first time anytime you try to load it again, it displays Captcha Expired.

  9. #9
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: Displaying Image From WebBrowser Onto PictureBox

    well of course it will with such things. i dont think its possible to do what you are trying to do. is there a reason you are doing what you are doing?

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  10. #10

    Thread Starter
    New Member
    Join Date
    Aug 2010
    Posts
    7

    Re: Displaying Image From WebBrowser Onto PictureBox

    Well it's possible here : http://www.vbforums.com/showthread.php?p=3754316 but it's for VB6, I'm wondering how to use that method in .NET

  11. #11
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: Displaying Image From WebBrowser Onto PictureBox

    but not for the captcha be it if you use VB6 or not.

    in the link, all they are doing is getting hold of the image, doing a clipboard copy, and pasting it into the picturebox.

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  12. #12
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Re: Displaying Image From WebBrowser Onto PictureBox

    Sounds to me that he/she is trying to create some kind of spam-tool... Am I correct?


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

  13. #13
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: Displaying Image From WebBrowser Onto PictureBox

    who knows but captcha was developed specifically for a purpose

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  14. #14
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Re: Displaying Image From WebBrowser Onto PictureBox

    hehehe.


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

  15. #15

    Thread Starter
    New Member
    Join Date
    Aug 2010
    Posts
    7

    Re: Displaying Image From WebBrowser Onto PictureBox

    Quote Originally Posted by Techno View Post
    but not for the captcha be it if you use VB6 or not.

    in the link, all they are doing is getting hold of the image, doing a clipboard copy, and pasting it into the picturebox.
    Yeah, that is exactly what I need to do. They can copy it because it is already loaded. Copying does not require the captcha to be loaded again. And I guess you can call it a spam-tool if you want, but it's not in that sense. More of a..automated form submitter.

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