Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Unzip file in Vb.Net

Unzip file in Vb.Net

Scheduled Pinned Locked Moved Visual Basic
csharphelp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fishbone365
    wrote on last edited by
    #1

    Here is some code that may help if you would like to unzip files in Vb.Net. The NZipLib.dll is required. Public Function UnZipFile(ByVal FileName As String, ByVal DirName As String) As String Dim s As ZipInputStream = New ZipInputStream(File.OpenRead(FileName)) Dim theEnTry As ZipEntry Dim filePath As String = Path.GetFileNameWithoutExtension(FileName) theEnTry = s.GetNextEntry() Dim di As New DirectoryInfo(DirName & filePath) If Not di.Exists Then di.Create() End If Dim count As Long While Not (theEnTry Is Nothing) Dim fs As FileStream = File.Create(DirName & filePath & "\" & theEnTry.Name) Dim nBytes As Integer Dim data() As Byte = New Byte(theEnTry.Size) {} Try nBytes = s.ReadByte() count = 1 While nBytes <> -1 Or count < (theEnTry.Size - 1) fs.WriteByte(nBytes) nBytes = s.ReadByte() count = count + 1 End While Catch ex As Exception MsgBox(ex.ToString) End Try fs.Close() theEnTry = s.GetNextEntry() End While s.Close() End Function Hope this helps you. Fishbone365

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups