Downloading file and extracting ZIP compressed file with Visual Basic.NET
Posted by Daniel - 3,568 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
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
Popular Entries
- Passing arguments to your VB.NET console application
- Microsoft Excel Import External Data Problem: When Microsoft Query doesn’t recognize some of your parameters
- Resize Image or Crop Image with Joe Lencioni’s Smart Image Resizer, WordPress Setup
- How to Get User Input and allowing more than 256 characters to be entered on .NET Console Application
- ASCII To PDU Converter (Convert ASCII to PDU and vice versa)
- ConsoleProgressBar - Simple Progress Bar Function for your VB.Net Console Application
- An example: Using CPort Delphi Component to read data from your cellphone
- Runtime-Form-Creation. Automatically creating child forms in a Delphi MDI application with a component array
- CPort Component (Serial port interface component for Delphi)
- SmartImageResizer Plugin, WordPress plugin based on Joe Lencioni’s Smart Image Resizer













