ComponentPro UltimateZip

      Creating a WinForms application

      Language Filter: AllSend comments on this topic to ComponentPro

      This tutorial will walk you through creating a WinForms application and add Zip control to it. It also shows how to:

      • Drag and Drop Zip control from the Toolbox to your form.
      • Set Zip properties.

      Creating a new project and adding ZIP control to it

      1. Start the Visual Studio .NET.
      2. From File menu, choose New, then choose Project.
      3. From the Project Creation dialog box, choose either Visual C# Projects or Visual Basic Projects then choose Windows Application. Specify a name and a location for the project, then click OK.
      4. Drag and drop the Zip control from the Toolbox to the form.
        Another way is to add references to ComponentPro.Zip.dll, ComponentPro.Common.dll, and ComponentPro.FileSystem.dll assemblies. Please see Installation instruction for C# and Installation instruction for VB.NET for more details.
      5. Now right click on the ZIP component icon (bound with red rectangle in the picture above) to show the context menu, click on the Properties... menu.
        Win Win
      6. Now make a quick application to test. Drag a Button onto the form.
      7. Add the following code to the button "OnClick" event handler. This code is for adding a file to a ZIP file.
        using System.Windows.Forms;
        using ComponentPro.Compression;
        // Create a new instance.
        Zip zip = new Zip();
        // Create a new zip file.
        // Add a single file into the archive.
        // Add a single file into the archive with the specified name.
        zip.AddFile(@"C:\test.txt", "my folder/my file");
        MessageBox.Show("Files have been added successfully");
        // Close the zip file.
      8. Compile and execute the application by navigating to the Debug menu and choose Start. Click the button and you should see a message indicating that the files have been successfully added to the ZIP file in the MessageBox.