Xceed Zip Compression Library Documentation
Convert method example for VB
Example topics > Convert method example for VB

This example allows you to convert an already existing zip file (c:\Temp\TEST.zip) into a Self-Extracting zip file (c:\Temp\zip.exe). The example requires that you place a button and an Xceed Zip control on a form and assign the following code to the button's click event. A Message box will display the result code.

Visual Basic Copy Code

Private Sub Command1_Click()

  Dim ResultCode As xcdError  

  Call XceedZip1.License( "your license key" ) 

  'Specify the full path and name of the zip file which we wish to convert. 
  XceedZip1.ZipFilename = "c:\temp\test.zip"  

  'Specify the path to the Self-Extractor Module binary that you want to use.
  'For this example we use the 32-bit binary 
  XceedZip1.SfxBinaryModule = "c:\temp\xcdsfx32.bin"  

  'Convert the zip file, while specifying the new filename 
  ResultCode = XceedZip1.Convert("c:\Temp\zip.exe")  

  'Check the return value, display error or success message  

  If ResultCode <> xerSuccess Then 
    MsgBox "Unsuccessful. Error # " & Str(ResultCode) & " occurred. " & "Description: " & _ 
           XceedZip1.GetErrorDescription(xvtError, ResultCode) 
  Else 
    MsgBox "The file was converted successfully." 
  End If  
End Sub