Download Files From the Internet using VB.NET and Higher

Click Star to Rate Post
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
 

This is code to do simple downloading of files from the internet using VB.NET and Higher. If you want many more downloading options, features, and more then check out this post with example. Otherwise the code below will get you started.

This method will consume your applications thread. So if you want your application to be able to user interaction while your downloading, then you can use DownloadFileAsync if you have Visual Basic 2005 and Higher. Otherwise you will need to download the file on a new thread if you don’t want your application to freeze until the download is complete.


Dim wClient As Net.WebClient = New Net.WebClient
'
'the web address to the file to download.
Dim theAddy AsString = "http://www.vbcodesource.com/dummyFile.txt"
'
'the file to download and the file to save the downloaded file too.
wClient.DownloadFile(theAddy, "c:\dummy.txt")

 

Leave a Reply

Your email address will not be published.