Interrupted Error in Form Load
Using components in the Form_Load() event may result in an "Interrupted" error because the controls have not yet been fully instantiated, so you can either:
- Use the components in Form_Activate(), or
- Create the component dynamically in code.
Creating a Component Dynamically
Ensure the FTP control is added as a reference in your VB project before using this approach.
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 support@nsoftware.com.