To enable asynchronous requests, we add a class module as an event handler for the onreadystatechange events of an IXMLHTTPRequest object.
To add the class module
Option Explicit
Sub OnReadyStateChange()
If form1.oHttpReq.readyState = 4 Then
form1.ProcessResponse
End If
End Sub
There are other ways to set up the event handler. For more information, see Use the OnReadyStateChange Property in Visual Basic.
Next, we'll set up a virtual directory. You must complete this step before you build and run the application.