"Interrupted" error when using components on Form_Load()

Whenever I try to use the components on Form_Load() I get an "Interrupted" error. Is it possible to use your components this way?

Date Entered: 12/15/1999    Last Updated: 06/04/2004

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 entry please contact our support team at kb@nsoftware.com.