This is because the controls have not been
instantiated correctly on the form before they
attempt and action. You can either use the
components on Form_Activate() or create the
component dynamically.
The following is an example of creating a component dynamically and using that control on Form_Load(). Note, you must assign the FTP control as a reference in your VB application before doing this.
Dim WithEvents ftp1 As FTP
Private Sub Form_Load()
Set ftp1 = New FTP
ftp1.RemoteHost = "xxx.xxx.xxx"
ftp1.User = "user"
ftp1.Password = "password"
ftp1.Logon
ftp1.ListDirectory
ftp1.Logoff
End Sub
Private Sub ftp1_DirList(DirEntry As String,
FileName As String, IsDir As Boolean, FileSize
As Long, FileTime As String)
Debug.Print FileName
End Sub
We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at kb@nsoftware.com.