Xceed Zip Compression Library Documentation
GetZipContents method example
Example topics > GetZipContents method example

This example gets the contents of the zip file and displays information related to each file in a list box. This example assumes that  you are in a windows application with a list box named ListBox1 on a form.

Visual Basic Copy Code

Dim objXceedZip As New XceedZipLib.XceedZip()
Dim xItem As XceedZipLib.XceedZipItem
Dim xZipItems As Object
Dim intResultCode As XceedZipLib.xcdError 

Call objXceedZip.License( "your license key" )

objXceedZip.ZipFilename = "c:\temp\test.zip"

intResultCode = objXceedZip.GetZipContents( xZipItems, _
                                            XceedZipLib.xcdContentsFormat.xcfCollection ) 

If intResultCode = 0 Then
   For Each xItem In CType( xZipItems, XceedZipLib.XceedZipItems )
      ListBox1.Items.Add( xItem.Filename & " ( " & xItem.Size & " bytes ) " )
   Next xItem
Else
   MsgBox( "Error: " & objXceedZip.GetErrorDescription( XceedZipLib.xcdValueType.xvtError, _
                                                        intResultCode ) )
End If