Form Re-loads when form closed? huh?
I have a program with a user control. In the user control is an Internet Control (to download stuff). If the user wants to Cancel the download and exit the program, for some reason the program re-opens and resumes download; Even after Inet.Cancel function is called.
AirDisp is the UserControl (instances of)
deletedCtrls is the number of deleted controls
Code:
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
Dim cCtrl As Integer
For cCtrl = 1 To AirDisp.Count + deletedCtrls - 1
AirDisp(cCtrl).Cancel
Next cCtrl
End Sub
My question is; is there a way to cancel the download and close the program?
Re: Form Re-loads when form closed? huh?
AirDisp(cCtrl).Cancel
Whatever that is it causes your form to re-referece controls and therfore form gets re-loaded.
Do that before you try to unload form or don't do it at all.
Re: Form Re-loads when form closed? huh?
But i dont no whats causing the form to re-load?
Re: Form Re-loads when form closed? huh?
I just told you... :confused:
AirDisp(cCtrl).Cancel
Re: Form Re-loads when form closed? huh?
Deleted the Unload Code out, still reloads :(
Re: Form Re-loads when form closed? huh?
In that case you did not show us everything - there must be something else.
How do you trigger form to get unloaded?
Re: Form Re-loads when form closed? huh?
Quote:
How do you trigger form to get unloaded?
By clicking the X button.
Re: Form Re-loads when form closed? huh?