In your code you are forgetting to give the image you downloaded (or file) a name, Plus I tested that link and I didnt see an image.
In either case, here is my code, works fine
'NameSpace
Next, Create a Sub called DGoogLogo
Code:
Private Sub DGoogLogo
End Sub
Next, Inside DGoogLogo Sub add this code
Code:
'Create a New WebClient
Dim wcli As Net.WebClient = New Net.WebClient
'Set The Location Of The File
Dim location As String = "http://vhirsch.com/blog/wp-content/uploads/2009/11/google_logo5.jpg"
' Finally Download The File.
wcli.DownloadFile(location, "c:\test\google_logo5.jpg")
Your code should look like this.
Code:
Private Sub DGoogLogo()
Dim wcli As Net.WebClient = New Net.WebClient
Dim location As String = "http://vhirsch.com/blog/wp-content/uploads/2009/11/google_logo5.jpg"
wcli.DownloadFile(location, "c:\test\google_logo5.jpg")
End Sub
Now Where ever you want Call DGoogLogo
For my purposes I will do it on the Form_Load Event
Code:
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
DGooglogo()
End Sub
Now if you run the project and check the C:\test folder you will find a google logo PNG
'It Looks like a lot, but that is only because I wanted to explain it, the code for this should be as small as this.
Imports System.Net
Public Class Form1
Private Sub DoDownload()
Dim wcli
As Net.WebClient =
New Net.WebClient
Dim location
As String = "http://vhirsch.com/blog/wp-content/uploads/2009/11/google_logo5.jpg"
wcli.DownloadFile(location, "c:\test\google_logo5.jpg")
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
DoDownload()
End Sub
End Class
Hope this helps