VB.NET Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

VB.NET Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML Conversion
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
PFX
RSA
S/MIME
SMTP
Socket
Spider
SSH
SSH Tunnel
SSH Key
SFTP
Tar Archive
Upload
XML
XMP
Zip Compression
Misc

More Examples...
Amazon S3
Email Object
DKIM / DomainKey
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

Byte Array
VB.NET FTPS
System.IO

 

 

 

 

 

 

Asynchronous FTP Download

Download: Chilkat .NET Assemblies

VB.NET example program showing how to download in a background thread, monitor the progress, an abort if necessary.

    ' Simple example to do an asynchronous FTP download in a background thread.
    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click

        Dim success As Boolean

        Dim ftp As New Chilkat.Ftp2()

        success = ftp.UnlockComponent("Anything for 30-day trial")
        If (Not success) Then
            MessageBox.Show("Component not unlocked")
            Exit Sub
        End If

        ' Set the FTP hostname, login, and password.
        ftp.Hostname = "ftp.***.com"
        ftp.Username = "***"
        ftp.Password = "***"

        ' Connect and login to the FTP server.
        success = ftp.Connect()
        If (Not success) Then
            MessageBox.Show(ftp.LastErrorText)
            Exit Sub
        End If

        ' Begin the download.
        success = ftp.AsyncGetFileStart("XmpSpecification.pdf", "xmpSpec.pdf")
        If (Not success) Then
            MessageBox.Show(ftp.LastErrorText)
            Exit Sub
        End If

        ' This is where your application might do other interesting tasks...
        ' This example will loop and update the current download rate and bytes
        ' transferred.
        While Not ftp.AsyncFinished

            System.Threading.Thread.Sleep(100)

            ' Handle application events so our user interface remains responsive.
            Application.DoEvents()

            ' Update label controls with the current data rate and # bytes downloaded.
            Label1.Text = "Bytes/Second: " & Convert.ToString(ftp.DownloadRate)
            Label1.Refresh()

            Label2.Text = "Bytes Received: " & Convert.ToString(ftp.AsyncBytesReceived)
            Label2.Refresh()

            ' The download can be aborted at any time by calling AsyncAbort
            If AbortButtonPressed Then
                ftp.AsyncAbort()
            End If

        End While

        ' The download is finished, now check the success:
        If Not ftp.AsyncSuccess Then

            MessageBox.Show(ftp.AsyncLog)

        End If

        ' Disconnect
        ftp.Disconnect()

        ' We're finished!
        MessageBox.Show("FTP Async Download Finished!")


    End Sub
 

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

Mail Component · XML Parser