Solved

Get image from webbrowser to Picturebox?

Posted on 2004-09-25
2
1,047 Views
Last Modified: 2008-01-09
I need to get an image from a webbrowser control to a picture box.. anyone know a good way to do this?
0
Comment
Question by:esdfesdf
2 Comments
 
LVL 11

Accepted Solution

by:
bingie earned 200 total points
ID: 12153111
You will have to download the picture first. Add a picture box and paste the following then run.

Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
        "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal _
                szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

Private Sub Form_Load()
szURL = "http://www.experts-exchange.com/images/certification.gif"
szFileName = "C:\ee.jpg"
Call URLDownloadToFile(0&, szURL, szFileName, 0, 0)
DoEvents
Picture1.Picture = LoadPicture("C:\ee.jpg")
End Sub
0
 
LVL 76

Expert Comment

by:David Lee
ID: 12155276
Another approach is to copy the image to the clipboard and then paste the clipboard into the picturebox.  If you always want to paste the image into a single picturebox, then you could add a button to your app that'd handle the pasting.  This would only require a single line of code.

    Picture1.Picture = Clipboard.GetData()

If you have multiple pictureboxes, then build a context menu so you can right-click on the picturebox you want to paste the image into and select paste.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now