Downloading file and extracting ZIP compressed file with Visual Basic.NET
Posted by Daniel - 2,007 Views
These are a couple examples of many simplified processes provided by the VB.NET. You can’t find these simplicity in its predecessor, the Traditional VB6.
Downloading a file - Believe it or not you only need less than 3 lines to download a file somewhere from the internet to you local drive. This sub procedure below can do that for you, without a reference to any library - it’s a built-in feature:
String)
Dim objDL As New System.Net.WebClient
objDL.DownloadFile(strURL, strSavePath)
End Sub
And the sample procedure call is below. It will download SimpleGridBuilder, one the the averagecoder’s free collection to your C:\ path:
&“wp-content/uploads/simplegridbuilder.zip”, “c:\simplegridbuilder.zip”)
Extracting a zip file - You need vsjlib installed on your system in order to be able to extract a zip file. This library can be found in the distribution of the Visual J#. Installing Visual J# will also install the vsjilib into you IDE.
After you had the vsjlib installed, you can do anything you want with java.util.zip.ZipEntry class. But for simplicity you can find a wrapper class on the internet such as the Matthew Hood’s class - the clsDWDZip.vb.
Do the following steps to include that wrapper class into your project:
- Download the clsDWDZip.vb
- Place it in the same folder of your project files folder
- From the VB.NET IDE, choose [Project]-[Add Existing Item…] Menu then select the clsDWDZip.vb
The following sub procedure can be used to perform ZIP extracting process in collaboration with the clsDWDZip.vb:
Dim objZipFile As New DWDZip.DWDZipFile
objZipFile.FilePath = strSourcePath
objZipFile.Open()
objZipFile.ExtractAllTo(strExtractTo)
End Sub
You can download the example project included in this article or if you need more alternatives, there is also a good information from MSDN. Click here to go there.
Download the example project (65 KB)
The following posts are programmatically considered as related to the current post by YARPP Plugin:
- Visual Basic.NET, an example of using HTTPWebRequest object
- Replacing and filtering text with regular expression using Delphi, Visual Basic and ASP
- Visual Basic Version of ASCII-to-PDU and PDU-to-ASCII Converter Functions
- Customizing the PDF file created with ContuttoPDF Wordpress Plugin
- Passing arguments to your VB.NET console application
Leave a Reply
Hi, my name is Daniel Nugraha, a single male live on an island called Java, Indonesia. This is the place for me to share my interest in computer programming.
-
Get my Full Feed Here
Comments - Thanks Guys :)
Rangga Kusuma: Gan, Tengkiu buat postingan yang sangat berguna. Kebetulan ada project utk bikin sms gateway, dan converter Agan sangat berguna utk...
Chuck Norton: I actually went ahead & bolted over to Justin’s Get The Image plugin here: http://justintadlock.com/ar...
Chuck Norton: Question: is it possible to insert something like [custfieldimg=”joice1.jpg,15 0,1:1″] into the actual templates instead of...
Therese Lachance: Hi, Any idea how to have ContuttoPDF fetch the correct page language?
tresloukadu: yo how did u fixed when the tags shows <? and it shows < “& l t ; ” ?? please send me an email.













