Using the HTTPXMLRequest onreadystatechange property from VB

When using the MS XML object from a Visual Basic application to send and receive WebDAV data, you need to use the HTTPXMLRequest interface. To do asynchronous calls, you need to set the onreadystatechange property with the function to call when your readystate changes (ie. when your call finishes). You unfortunately can not DIM your HTTPXMLrequest interface WITH EVENTS like you can with the XMLDOM interface. Also, unlike VBScript, you can not use the GetRef function to create a object that represents a function. In order to set this property from a VB Application (form or DLL), you need an object. 1) Create an new class module for your application. 2) Create a single function (with no parameters). 3) Set this function as the default for the class. 4) In your XML request code, create an object of your class module. 5) Set the XMLHTTPRequest.OnReadyStateChange property equal to your new object. Your default function will be called everytime the readystate changes for your XMLHTTPREQUEST object.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish