Results 1 to 3 of 3

Thread: Want to use DotNetZip

  1. #1
    darxide is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Mar 2012
    Posts
    6
    Reputation
    0

    Want to use DotNetZip

    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.

  2. #2
    Herman is offline VB.NET Forum Miyagee
    .NET Framework
    .NET 4.0
    Join Date
    Oct 2011
    Location
    Montreal, QC, CA
    Posts
    466
    Reputation
    348
    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 by Herman; 03-30-2012 at 6:59 PM.

  3. #3
    darxide is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Mar 2012
    Posts
    6
    Reputation
    0
    Took me a while, but I finally found that I needed to have Imports Ionic.Zip at the top of the code.

    Thanks.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking