Important alert: (current site time 7/15/2013 8:08:28 AM EDT)
 

winzip icon

A+ VB.NET Zip Library

Email
Submitted on: 9/9/2004 2:03:30 AM
By: Matthew Hood 
Level: Intermediate
User Rating: By 7 Users
Compatibility: C#, VB.NET, ASP.NET
Views: 29783
 
     This is a Zip File compression class created in VB.NET (using the J# library). It is able to open and create Zip files, and provides the basic Adding/Extracting/Removing of entries. This was designed to be a simple class that can be imported to any project to provide limited Zipping functionality without the need to reference & distribute 3rd party dll's. I've commented on almost all the code, but haven't had the change to make a demo app. Other than that, it's a pretty decent piece of work that I've used in almost all my apps. Please vote if you find this class usefull.
 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
9/22/2004 7:49:54 PM

Can you please give a small sample of how your code works.

(If this comment was disrespectful, please report it.)

 
9/22/2004 7:57:08 PM

Dim fZip As New DWDZip.DWDZipFile
fZip.FilePath = "c:\Test.Zip"
fZip.Open(True)
fZip.Entries.AddFile(FileName)
fZip.Update()
fZip.Close()
(If this comment was disrespectful, please report it.)

 
10/11/2004 2:46:24 PM

Pretty good, but the date/time of the files are not stored in the zip file.
(If this comment was disrespectful, please report it.)

 
10/16/2004 11:05:41 PM

I put this class into an existing solution but have errors on these lines....For Each Entry As ZipEntry In New EnumerationAdapter(FromFile.entries)
My solution is a vb.net solution, is there something else I need to do?
(If this comment was disrespectful, please report it.)

 
10/21/2004 9:05:22 AM

The method 'AddDirectory' does't work correctly. For example:

Dim sDestinDir As String = "C:\datadir"
Try
fZip.Open(True)
fZip.Entries.AddDirectory(sDestinDir,True) fZip.Update()
fZip.Close()
Catch
ex As Exception
MsgBox("FILE ZIP CREATION FAILED: " & sDestinDir & " [ERRMSG:" & ex.Message & "]")
End Try

create an exception message: "FILE ZIP CREATION FAILED: C:\datadir [ERRMSG:C:\datadir]"
(If this comment was disrespectful, please report it.)

 
6/3/2005 9:16:10 PM

Sorry I reported someone as offending feed back by mistake! I think it was the guy talking bout how a directory function wasnt workin... Any how, I was gonna say this to the auther! Please Mention that your class requires the JAVA SDK!!! as in Imports java.util.zip which is the third line! So without a JAVA sdk it is useless? Or did I misunderstand? anyhow .NET does not seem to know where to import it from!! Unless I guess you have JAVA sdk clarify some things please
(If this comment was disrespectful, please report it.)

 
6/3/2005 9:26:45 PM

I think all I need is to reference vjslib.dll hope to find it in .NET components list as I try to add it
_______________________________________
(If this comment was disrespectful, please report it.)

 
6/4/2005 1:02:21 PMMatthew Hood

This class requires the MS J# Runtime to be installed which has the vjslib.dll. Since my app installs check for this runtime and install it if necessary, it is always available.
(If this comment was disrespectful, please report it.)

 
6/27/2005 7:54:48 PM

The method 'AddDirectory' does't work
correctly, I need it, so could you help me? send me the code thx
(If this comment was disrespectful, please report it.)

 
10/20/2005 11:54:53 AMJon

While using your sample code of 9/22/2004 I get this error: 'java.util.zip.ZipException'in vjslib.dll.
Does anyone know how to solve it?. Thank you.
(If this comment was disrespectful, please report it.)

 
10/21/2005 10:15:54 AMMatthew Hood

Have a look at this article from Microsoft.

http://msdn.microsoft.com/vbrun/vbfusion/smallandunreadable2/default.a spx

(If this comment was disrespectful, please report it.)

 
6/13/2006 8:50:23 AMzeno

give some c# codings
(If this comment was disrespectful, please report it.)

 
7/13/2006 9:34:10 AMBen

im trying to use your code in vb, could you pls vb example? eg unzip. thx
(If this comment was disrespectful, please report it.)

 
11/22/2007 8:19:22 PMBenoit Robin

user geting error (Reference error) you just need to add a reference to the vjslib.dll, the path look like this : C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\vjslib.dll
this will not be the same for all user(only the framewotk version will change) hope this will help you
(If this comment was disrespectful, please report it.)

 
12/5/2007 1:51:35 AMIvan

When I run this code
Dim fZip As New DWDZip.DWDZipFile
fZip.FilePath = "c:\temp\Test.Zip" fZip.Open(True)

I get the following error trying to Open

System.Security.SecurityException {"Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."} System.Security.SecurityException

please help
(If this comment was disrespectful, please report it.)

 
10/12/2010 3:04:02 AMManage

to install Java Lib on Client, use following link to "Microsoft Visual J# Version 2.0 Redistributable Package"
http://www.microsoft.com/downloads/details.aspx?familyid=f72c74b3-ed0e-4af8-
ae63 -2f0e42501be1&displaylang=de

(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.