VB.NET Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

VB.NET Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML to XML
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...
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

 

 

 

 

 

 

FTP Download File with Progress Monitoring

Download Chilkat .NET for 4.0 Framework

Download Chilkat .NET for 64-bit 4.0 Framework (x64)

Download Chilkat .NET for 2.0 / 3.5 Framework

Download Chilkat .NET for 64-bit 2.0 / 3.5 Framework (x64)

Download Chilkat .NET for 1.0 / 1.1 Framework

This VB.NET example program demonstrates how to do an FTP download with progress monitoring. The only real difference between the upload and download examples is that the upload calls PutFile and the download calls GetFile.

    ' When using events, the Chilkat.Ftp2 object must be a class member or global variable.
    Dim WithEvents ftp2 As New Chilkat.Ftp2

    ' Update the progress bar control with the percent done.
    Private Sub ftp2_OnFtpPercentDone(ByVal sender As Object, ByVal args As Chilkat.FtpPercentDoneEventArgs) Handles ftp2.OnFtpPercentDone

        ProgressBar1.Value = args.PercentDone

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        ftp2.UnlockComponent("Anything for 30-day trial")

        ftp2.Hostname = "ftp.chilkatsoft.com"
        ftp2.Username = "****"
        ftp2.Password = "****"

        ' EnableEvents must be set to True for events to fire.
        ftp2.EnableEvents = True

        ' Some FTP server may require that the AutoGetSizeForProgress property be set to true.
        ' Only do this if you see that percent-done progress events are not firing.  
        ftp2.AutoGetSizeForProgress = True

        ' Connect to the FTP server and login.
        Dim success As Boolean
        success = ftp2.Connect()
        If (Not success) Then
            ftp2.SaveLastError("ftpError.txt")
            Exit Sub
        End If

        ' Navigate to the "testing" subdirectory on the ftp server.
        success = ftp2.ChangeRemoteDir("testing")
        If (Not success) Then
            ftp2.SaveLastError("ftpError.txt")
            Exit Sub
        End If

        ' Download the file. 
        ' The 1st argument is the remote filename, the 2nd argument
        ' is the local filename to be created.
        success = ftp2.GetFile("big.gif", "bigLocal.gif")
        If (Not success) Then
            ftp2.SaveLastError("ftpError.txt")
            Exit Sub
        End If

        ftp2.Disconnect()

    End Sub




 

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

Mail Component · XML Parser