VB.NET Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

VB.NET Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML to XML
HTTP
IMAP
Encryption
MHT / HTML Email
PFX
RSA Encryption
S/MIME
Socket
Spider
Tar Archive
Upload
XML
XMP
Zip Compression
Misc

More Examples...
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor

Byte Array
VB.NET FTPS
System.IO

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

 

 

 

 

 

Zip / Unzip In-Memory

Download Chilkat .NET for 2.0 / 3.5 Framework

Download Chilkat .NET for 1.0 / 1.1 Framework

Demonstrates how to do in-memory Zip compression and decompression.

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim zip As New Chilkat.Zip()
        zip.UnlockComponent("30-day trial")

        ' Get some byte to compress.
        Dim inBytes As Byte()
        inBytes = System.Text.Encoding.ASCII.GetBytes(TextBox1.Text)

        ' Display the length of the uncompressed bytes.
        TextBox2.Text = Str(inBytes.Length)

        ' Append the data to the in-memory Zip object.
        ' No files are every produced by this example program.
        Dim entry As Chilkat.ZipEntry
        entry = zip.AppendData("inBytes.dat", inBytes)

        ' Get the compressed data.
        Dim compressedBytes As Byte()
        compressedBytes = entry.Copy()

        ' Show the length of the compressed data.
        TextBox3.Text = Str(compressedBytes.Length)

        ' In a real app, the compressed data might be persisted or sent
        ' as part of a message over a connection, perhaps as part of a Web Service RPC.

        ' Now restore the original data from the compressed....
        ' Create a new Zip object.  
        Dim zip2 As New Chilkat.Zip()
        zip2.NewZip("something.zip")

        ' Append the compressed data to the in-memory Zip object, and inflate it.
        Dim outBytes As Byte()
        Dim entry2 As Chilkat.ZipEntry
        entry2 = zip2.AppendCompressed("blahblah.dat", compressedBytes)
        outBytes = entry2.Inflate()

        ' Convert the byte array to a string.
        Dim c As Char()
        c = System.Text.Encoding.Default.GetChars(outBytes)
        Dim sb As New System.Text.StringBuilder()
        TextBox4.Text = sb.Insert(0, c).ToString()

    End Sub



Important: The download for this example does not contain the ChilkatDotNet.dll which
must be downloaded and installed separately at http://www.chilkatsoft.com/downloads.asp.
Once installed, add a reference to the DLL in the project by following the instructions at
http://www.example-code.com/vbdotnet/step2.asp

 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2007 Chilkat Software, Inc. All Rights Reserved.

Mail Component · XML Parser