onTransferProgress and events in VB6

I've made pretty good progress with the VB6 sample code in the past couple of days. I've managed to get good multi file uploads and download working well.

I want to monitor file upload and download progress but I cannot get the ' Dim WithEvents objFTP As FTPConnectionSTA' and associated code to work in VB6.

I want to stay in VB6 because of the reduced requirement on my clients to have .NET on their computers.

Could you shed some light on making that VB6 example code work with onTransferProgress?

When I use Dim WithEvents objFTP As FTPConnectionSTA with the example code I get a compiler error ("Only valid in object module."). In the example that is the only module.

I also don't see in the VB6 example how and where to attach the events and where to put the onTransferProgress event code.

Thanks for all of your help. Based on what I've got done already there's little doubt we'll be purchasing very soon.

Thanks for all of your help.


I have to admit that we don't have VB6 installed anymore as it conflicted with other applications. But I've found the following article which explains how to use events in VB6:

Try the following:

Public WithEvents objFTP As sfFTPLib.FTPConnectionSTA


' Event handler

Private Sub objFTP_OnTransferProgress(ByVal nBytesTransferredLo As as Integer, ByVal nBytesTransferredHi As as Integer)

  Call MsgBox("OnTransferProgress")

End Sub

Please let me know about your results. Thank you.