Errors trying to use DotNetZip

Oct 15, 2009 at 3:48 PM
Edited Oct 15, 2009 at 3:50 PM

Ok i downloaded the developers package.

 

I added a reference to the project from the RELEASE subdirectory.

 

I used the following code

 

Imports Ionic.Zip

Dim ZipToUnpack As String = "C:\Documents and Settings\ΙΩΑΝΝΗΣ\Επιφάνεια εργασίας\TEMPSUUNTO\divelogs.zip" Dim TargetDir As String = "C:\Documents and Settings\ΙΩΑΝΝΗΣ\Επιφάνεια εργασίας\TEMPSUUNTO\" Console.WriteLine("Extracting file {0} to {1}", ZipToUnpack, TargetDir)
Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)
AddHandler zip1.ExtractProgress, AddressOf MyExtractProgress
Dim e As ZipEntry
' here, we extract every entry, but we could extract ' based on entry name, size, date, etc. For Each e In zip1
e.Extract(TargetDir, ExtractExistingFileAction.OverwriteSilently)
Next End Using

The following errors came up

Error    1    Name 'MyExtractProgress' is not declared.    
C:\Documents and Settings\ΙΩΑΝΝΗΣ\Local Settings\Application Data\Temporary Projects\WindowsApplication1\Form1.vb    10    56    WindowsApplication1

Error    2    Variable 'e' hides a variable in an enclosing block.
C:\Documents and Settings\ΙΩΑΝΝΗΣ\Local Settings\Application Data\Temporary Projects\WindowsApplication1\Form1.vb    11    17    WindowsApplication1

Can i have some help ?

Thanks

 

Coordinator
Oct 15, 2009 at 9:31 PM

These are not errors with DotNetZip. These are basic VB coding issues, nothing to do specifically with DotNetZip.

The error about 'MyExtractProgress' means you have to define a Sub with that name. 

The error about "e hides a variable' means your Function or Sub already has a variable by the name of e.  (Probably an EventArgs variable).  You can only have one variable named e.  You have to rename one of them.

The best I can advise is to keep working on it yourself - you'll need to figure these compilation error things out on your own. Maybe get a book that covers this stuff.

 

Oct 16, 2009 at 6:08 AM

Yes i fixed them 5 minutes after i posted.The e variable issue was, because i put the code in a button event which already has an e variable declare.

 

Thanks.