VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Get Web Page Picture Into your Form Image Box ......

by Gehan Fernando. (13 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 17th September 2007
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Get Web Page Picture Into your Form Image Box ......

API Declarations


.IO
.Net
.Text

Rate Get Web Page Picture Into your Form Image Box ......




    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        'http://www.cnet.co.uk/i/c/blg/cat/digitalmusic/mario_apple.jpg 
        'http://www.designest.com/img/desktop/1_apple_a_day_1024.jpg

        If TextBox1.Text.ToString().Trim().Length = 0 Then _
        MessageBox.Show("Set URL Path", "URL Path", MessageBoxButtons.OK, MessageBoxIcon.Error) _
      : Exit Sub

        Me.Cursor = Cursors.WaitCursor

        Dim objmemstream As MemoryStream
        Dim objwebclient As WebClient
        Dim url As String = TextBox1.Text.ToString().Trim()

        If Not url.ToLower().StartsWith("http://") Then
            url = "http://" & url
        End If

        objwebclient = New WebClient()
        objmemstream = New MemoryStream(objwebclient.DownloadData(url))
        PictureBox1.Image = Bitmap.FromStream(objmemstream)

        Me.Cursor = Cursors.Default

    End Sub

End Class

Download this snippet    Add to My Saved Code

Get Web Page Picture Into your Form Image Box ...... Comments

No comments have been posted about Get Web Page Picture Into your Form Image Box ....... Why not be the first to post a comment about Get Web Page Picture Into your Form Image Box .......

Post your comment

Subject:
Message:
0/1000 characters