I'm using the edtftp control in a small FTP application made in VB 2005. I've been working on it for a couple of weeks and everything was ok. The last few days I have been tweaking the GUI, and I've added an option to start minimized. The weird thing is, when I start the program minimized and it starts to transfer the file specified in the commandline, I get an error. When I run it with Me.Windowstate = FormWindowState.Normal the transfer works fine. When I start the program normally, and I minimize it between the FTP connect and transfer, it also gives the error. If I minimize the form AFTER the transfer has started, it works fine
This is the error I'm getting
Exception has been thrown by the target of an invocation.
If FtpC.IsConnected = True Then
Try
StatusLabel.Text = "Uploading file: " & DestinationFile
FtpC.UploadFile(s, DestinationFile)
Catch ex As System.Exception
Console.WriteLine("Error during transfer" & vbCrLf & ex.Message)
MessageBox.Show("Error during transfer" & vbCrLf & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exiting = True
Application.Exit()
End
End Try
End If
So, the above code runs fine when the form is in its normal state, but it throws an exception when minimized.