Adding a Callback Event Handler in VB.NET

  1. Dim “WithEvents”
    Dim WithEvents ftp As Chilkat.Ftp2
  2. Add some code to create a new instance of the object.
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            ftp = New Chilkat.Ftp2()
            ftp.EnableEvents = True
            ftp.HeartbeatMs = 100
  3. Select the “ftp” object.

  4. Select the event. This causes Visual Studio to generate the event handler function.

  5. Add your application code to the event handler function.
    Private Sub ftp_OnAbortCheck(ByVal sender As Object, ByVal args As Chilkat.AbortCheckEventArgs) Handles ftp.OnAbortCheck
        ' Add your application code here...
        End Sub