473,399 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Unzipping in Visual Basic .Net

Hello, I've been trying to unzip a file in Visual Basic .Net (03) but
I'm getting an error. I do get the destination directory and I do get
the first extracted file, but then it stops and I get an wrong local
header signature error. I've added the SharpZipLib.dll library to my
project, so that's what I'm using. The zip files contains 9 text
files.

This is the error I get:
An unhandled exception of type 'ICSharpCode.SharpZipLib.ZipException'
occurred in sharpziplib.dll
Additional information: Wrong Local header signature-1826153501

I have the following in the top of my code:
Imports System
Imports System.IO
Imports ICSharpCode.SharpZipLib.Zip

This is what I have in my button:

Private Sub btnUnzip_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnUnzip.Click

Dim fileName As String = Path.GetFullPath("c:\testing.zip")
Dim destPath As String = Path.GetFullPath("c:\unzipped\")

If Not Directory.Exists(destPath) Then
Directory.CreateDirectory(destPath)
Else
For Each s As String In Directory.GetFiles(destPath)
File.Delete(s)
Next
End If

Dim inStream As New ZipInputStream(File.OpenRead(fileName))
Dim outStream As FileStream

Dim entry As ZipEntry
Dim buff(2047) As Byte
Dim bytes As Integer

Do While True
entry = inStream.GetNextEntry() <==== This is where the
error occurs!
If entry Is Nothing Then
Exit Do
End If
outStream = File.Create(destPath + entry.Name, 2048)

Do While True
bytes = inStream.Read(buff, 0, 2048)
If bytes = 0 Then
Exit Do
End If
outStream.Write(buff, 0, bytes)
MsgBox("writing")
Loop
outStream.Close()
Loop
inStream.Close()
End Sub

Any help would be greatly appreciated.

Thanks.

Apr 4 '06 #1
3 1834
Hello again, I just want to point out that I created a new zip file
with Winzip with 2 text files in it and tested the code and it worked.
However, when I tested again the Zip file I actually need to unzip, I
still get the Wrong Local header signature-1826153501 error.

Apr 4 '06 #2
Can WinZip open the errant zip file?

Apr 4 '06 #3
Yes, Winzip can open the zip file I need with no problems.

Thanks.

Apr 4 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: pix | last post by:
Hello, I would like to start learning Visual Basic, and I was wondering if there are any recomendations to any ebooks, or actual books for that matter. I have my eye on this book by John Smiley,...
2
by: AK | last post by:
I don't want any part of the previous discussion on Visual Basic versus Visual Basic.Net. My query is about using Visual Basic for Applications; and whether it is better to use Visual Basic 6 or...
2
by: Ralph | last post by:
I used to have Visual Basic .net std. 2003 installed on WinXP SP1A. But I found it too hard to upgrade WinXP to SP2. Now, I do have WinXP SP2 installed, but I am having problems installing...
2
by: frossberg | last post by:
Hello! I tried to install the Visual Basic.NET Resource Kit (http://msdn.microsoft.com/vbasic/vbrkit/) but obviously something went very wrong and now it sems impossible both to repair and to...
4
by: sqlguy | last post by:
Why do we have to contact MS for a problem that has been with this compiler from at least the beta of VS 20005. I am so sick and tired of the 30 - 40 clicks it takes to dismiss VS when there is a...
97
by: Master Programmer | last post by:
An friend insider told me that VB is to be killled off within 18 months. I guess this makes sence now that C# is here. I believe it and am actualy surprised they ever even included it in VS 2003 in...
11
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
I have seen the terms Visual Basic 2005 and VB.NET. It seems that sometimes they seem to be referring to the same thing but sometimes they are not. I also run into terms like VB9 and VB10.
1
by: deepakd | last post by:
Hi I'm using wxZipInputStream for unzipping a zipped ".app" file in MAC OS.After unzipping i am not able to run the app.When i manually copy the unix executable to app packages, I am able to run...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.