Download an Image into a byte array with vb.net

Good Morning! It was a relaxing weekend of sorts. I figured out a SQL statement for work that was really being a pain in the butt and helped a friend out. Other than that, it was pretty relaxing.

Today’s topic is how to download an image into a byte array using vb.net. Make it a great day!


Join me on Facebook

Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
    Dim client As New WebClient()
    Try
        Dim imagedata As Byte() = client.DownloadData("http://images2.wikia.nocookie.net/wowwiki/images/e/ed/Icon-new-48×48.png")
        Using ms1 As New MemoryStream(imagedata )
            Dim i As New Image(ms1)
            Me.Image= i
        End Using
    Catch ex As SystemException
        Debug.WriteLine(ex.Message)
    End Try
End Sub

Technorati Tags: ,,,,,,,,,,,,,,,,
,,

Advertisements
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: