Microsoft KB Archive/257853

= PRB: Problem Occurs When You Call ITC Execute from Form_Load =

Article ID: 257853

Article Last Modified on 6/17/2002

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q257853



SYMPTOMS
It may be tempting to call the Execute method of Internet Transfer Control in Form_Load with the intention to send a request automatically. However, the StateChanged subroutine may not get called if the method is called when the form is being loaded.



RESOLUTION
To send a request automatically with the Execute method, you can call the method in Sub Main and set Sub Main as the startup object:  Add a module to the Visual Basic project. Add Sub Main to the module. Select Sub Main as the Startup Object from the project Properties. Remove Sub Form_Load from the form.  Call the Execute method in Sub Main as follows: Sub Main Load Form1 'Form1.Show ...  Form1.Inet1.Execute ... End Sub 

