Solved

Get image from webbrowser to Picturebox?

Posted on 2004-09-25
2
1,045 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
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

771 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

12 Experts available now in Live!

Get 1:1 Help Now