user4951
user4951

Reputation: 33130

Why iHTMLelementcollection.item returns object

Why not ihtmlelement?

It's very confusing for many programmers that like to use the auto complete.

Upvotes: 0

Views: 439

Answers (1)

Hans Passant
Hans Passant

Reputation: 942020

It is a COM interface that was optimized to be used for scripting languages. The actual type is IDispatch, a late-binding Automation interface type. That will show up as Object in VB.NET.

There are many different element types, IHTMLxxxElement where xxx can be Anchor, Block, Body, Button, Comment, Control, Div, and many more. Simply cast with CType() to get the element type you want, including IHTMLElement. Or take advantage of VB.NET's built-in support for late binding, albeit that you won't get IntelliSense with that.

Upvotes: 1

Related Questions