Question Want to use DotNetZip

darxide

Member
Joined
Mar 30, 2012
Messages
9
Programming Experience
1-3
DotNetZip: DotNetZip Library

I've been using VB for quite a number of years, but I've only ever used it for creating personal programs to help me with various tasks. I've never gotten very in-depth with it and anybody would call most of the things I write very "elementary."

I want to use DotNetZip to extract files from a zip file, but I don't know the first place to begin. For starters, I don't know how to use an external DLL with my vb.net program. Google is far from helpful, all the results take me to places where people are asking for help in getting their external dll to work, but it's obvious they already know the basics. I don't even know step 1 and have been become extremely frustrated with the lack of relevant search results so I'm just going to ask the question here so I can get the proper answer the first time.

If someone could just explain how you use an external DLL and possibly give an example of how to use DotNetZip to extract a zip file with directory structure and overwrite always, I would be forever in your debt.

Thanks.
 

Herman

Well-known member
Joined
Oct 18, 2011
Messages
882
Location
Montreal, QC, CA
Programming Experience
10+
To use an external library you add a reference to it to your VB project. After that is done, I would move over to the DotNetZip documentation...

Ionic Zip Library v1.9.1.6 - Table of Content

DotNetZip Library

Here is a very simple example to decompress a zip file into the source path with no progress indication:

    Public Sub DecompressFile(ByVal strFilename As String)
        Dim Path As String = strFilename.Substring(0, strFilename.LastIndexOf(Chr(92)))
        Using ZIP As Ionic.Zip.ZipFile = Ionic.Zip.ZipFile.Read(strFilename)
            Try
                ZIP.ExtractAll(Path, Ionic.Zip.ExtractExistingFileAction.OverwriteSilently)
            Catch Exc As Exception
                MsgBox Exc.Message
            End Try
        End Using
    End Sub
 
Last edited:

darxide

Member
Joined
Mar 30, 2012
Messages
9
Programming Experience
1-3
Took me a while, but I finally found that I needed to have Imports Ionic.Zip at the top of the code.

Thanks.
 
Top Bottom