dcsimg
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: XML
Expertise: Beginner
Nov 1, 1999

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Invoke Async Call by XMLHTTPRequest in VB

Question:
I am using the XMLHTTPRequest object in Visual Basic to invoke an async call. How do I register a complete event handler of the XMLHTTPRequest object?

Answer:
You're not going to be happy with this answer, but there isn't any way to register an event handler in VB. The XMLHTTPRequest object doesn't source the event in Visual Basic—only in a scripting environment. All that the async attribute of the Open command does is turn off blocking when the Send method is invoked. I was a little surprised myself when I discovered this, as it is definitely a bad implementation. Probably the simplest solution in this situation is to poll the XMLHTTP object until its readyState gets set to 4 (i.e., "complete"). This isn't ideal, but unless you have a browser running within your application and can use the scripting version of the command, you're basically out of luck.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Thanks for your registration, follow us on our social networks to keep up-to-date