Exception 0x800A01B6 using getElementById after the first load

混江龙づ霸主 提交于 2019-11-29 18:12:30

The type of the Document property is only resolved at run-time, so it's an Object until then. This is why calling any methods in it results in the so-called late binding - you do not yet know if the getElementById method exists or not, so that has to be determined a run-time.

You most likely get the error because the Document is not of the IHTMLDocument3 type, which is the only document type that includes the getElementById method.

What you can try is casting the Document to an IHTMLDocument3 interface. Since it inherits IHTMLDocument and IHTMLDocument2 you can cast between them even if the document is actually one of the earlier types.

DirectCast(ie.Document, IHTMLDocument3).getElementById("hdnstring")
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!