HTML Element Click method

bhavin12300

Active member
Joined
Sep 18, 2007
Messages
44
Programming Experience
Beginner
hi
i have been using vb6 since now and moved to vb.net.
i am using html object library in my project.
IN vb6 i was using iHTMLElement class method called "click".
now in vb.net that class is named as htmlelement class but it does not contain any method called "click" in it.

so my query is what is equivalent method in vb.net for "click" which is method of IHTMLElement in Vb6 ?????

does its name gets change??????
 
The documentation answers all your questions, quoted here for your convenience:
HtmlElement represents any possible type of element in an HTML document, such as BODY, TABLE, and FORM, among others. The class exposes the most common properties you can expect to find on all elements.

You often need access to attributes, properties, and methods on the underlying element that are not directly exposed by HtmlElement, such as the SRC attribute on an IMG element or the Submit method on a FORM. The GetAttribute and SetAttribute methods enable you to retrieve and alter any attribute or property on a specific element, while InvokeMember provides access to any methods not exposed in the managed Document Object Model (DOM). If your application has unmanaged code permission, you can also access unexposed properties and methods with the DomElement attribute.
In short, use the HtmlElement.InvokeMember method to invoke the "click" method of IHtmlElement interface.
VB.NET:
el.InvokeMember("click")
DomElement property can be used as indicated, for example with late binding
VB.NET:
el.DomElement.click()
If you reference the MSHTML Com library you can also cast DomElement directly to IHtmlElement like this:
VB.NET:
Dim i As MSHTML.IHTMLElement = el.DomElement
i.click()
 
Back
Top