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
Service
PPMD
Deflate
DH Key Exchange
DSA

Byte Array
VB.NET FTPS
System.IO

Unreleased...
Bzip2
LZW
Bz2
Icon

 

 

 

 

 

 

Embed GIF Image in XML

Download VB.NET Project Files and Source Code

VB.NET sample code showing how to embed a GIF image in an XML document.

    ' Add a GIF image to the Chilkat company record.
    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click

        Dim xml As New Chilkat.Xml()
        xml.LoadXmlFile("companies.xml")

        ' Quickly locate the Chilkat record.
        ' This updates the internal reference to point
        ' to the record that was found.
        Dim zipFlag As Boolean
        Dim aesEncryptFlag As Boolean
        Dim password As String
        zipFlag = False
        aesEncryptFlag = False
        password = ""

        If (xml.SearchForContent2(Nothing, "name", "Chilkat*")) Then

            ' Move up to the record level.
            xml.GetParent2()

            Dim gifNode As Chilkat.Xml
            gifNode = xml.NewChild("gif_image", "")

            ' The data can be optionally Zip compressed and/or AES encrypted.
            gifNode.SetBinaryContentFromFile("dude.gif", zipFlag, aesEncryptFlag, password)

            ' Save the XML with the embedded GIF.
            xml.GetRoot2()
            xml.SaveXml("embeddedGif.xml")

            ' This code extracts the GIF image from the XML
            Dim xml2 As New Chilkat.Xml()
            xml2.LoadXmlFile("embeddedGif.xml")
            xml2.SearchForTag2(Nothing, "gif_image")
            xml2.SaveBinaryContent("dude2.gif", zipFlag, aesEncryptFlag, password)

        End If

    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