'Option Strict On disallows late binding' problem

J

John

Hi

I am trying to create a Microsoft.XMLHTTP object via below code;

Dim oHttpPost As Object
oHttpPost = CreateObject("Microsoft.XMLHTTP")
oHttpPost.Open("POST", "www.myurl.com", False)

The problem is that I am getting an error on the statement oHttpPost.Open.
What type of variable do I need to declare oHttpPost as?

Thanks

Regards
 
H

Herfried K. Wagner [MVP]

John said:
I am trying to create a Microsoft.XMLHTTP object via below code;

Dim oHttpPost As Object
oHttpPost = CreateObject("Microsoft.XMLHTTP")
oHttpPost.Open("POST", "www.myurl.com", False)

The problem is that I am getting an error on the statement oHttpPost.Open.
What type of variable do I need to declare oHttpPost as?

Either disable 'Option Strict' for the file to allow late binding or add a
reference to the MSXML COM library, import the required namespaces and use
the classes defined in the namespaces.
 
J

John

Hi Herfried

Thanks for this. I have several references to XML;

Microsoft XML, v2.6
Microsoft XML, v3.0
Microsoft XML, v5.0
Microsoft XML, v6.0
Microsoft XML, version 2.0

Does it matter which one to use?

Thanks

Regards
 
S

Steve Gerrard

It would make more sense to me, if you are doing this in .Net, to use the
System.Net.HttpWebRequest class, rather than using the older COM version. It
should provide equivalent methods for everything you might need to do.

By the way, for most ordinary XML, it doesn't make any difference which version
of MS-XML you use. Using an older one ensures a wider range of compatibility.
 
S

sloan

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top