PRB: Problem Occurs When You Call ITC Execute from Form_Load (257853)



The information in this article applies to:

  • Microsoft Visual Basic Professional Edition for Windows 5.0
  • Microsoft Visual Basic Professional Edition for Windows 6.0
  • Microsoft Visual Basic Enterprise Edition for Windows 5.0
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0

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:
  1. Add a module to the Visual Basic project.
  2. Add Sub Main() to the module.
  3. Select Sub Main() as the Startup Object from the project Properties.
  4. Remove Sub Form_Load from the form.
  5. Call the Execute method in Sub Main() as follows:
    Sub Main()
       Load Form1
       'Form1.Show
       ...
       Form1.Inet1.Execute ...
    End Sub
    					

REFERENCES

For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:

232632 ITC Access Violation with Internet Explorer 5

185519 Vbinet.exe WinInet API Declarations for Visual Basic

193625 WinInet Error Codes (12001 through 12156)

Win32 Internet HTTP Functions in Visual Basic

WinInet APIs Documentation

Modification Type:MajorLast Reviewed:6/17/2002
Keywords:kbhttp kbITC kbprb KB257853