I am using the WebBrowser control. I want to find out what are the different HTML Form elements existing in the web page a user is currently viewing. How do I do that?
Thanks,
Arpan
Printable View
I am using the WebBrowser control. I want to find out what are the different HTML Form elements existing in the web page a user is currently viewing. How do I do that?
Thanks,
Arpan
Reference the MS HTML Object Library
VB Code:
Private Sub Form_Load() WebBrowser1.Navigate "http://www.vbforums.com/newthread.php?do=newthread&f=1" End Sub Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant) If (pDisp Is WebBrowser1.Application) Then On Error Resume Next Dim wForm As HTMLFormElement Dim wElem As HTMLInputElement Set wForm = WebBrowser1.Document.Forms(1) 'Note the ONE (its actually the Second Form) For x = 0 To wForm.elements.length If TypeOf wForm.Item(x) Is HTMLInputElement Then Set wElem = wForm.Item(x) Debug.Print wElem.Name & ": " & wElem.Type End If Next End If End Sub
Thanks, Static, that's exactly what I was looking out for.
BTW, to access all the hyperlinks existing in a web page, one can use wWeb.Document.All.tags("a") or to access the Forms, one can use wWeb.Document.All.tags("form").Name.
I would like to know like ("a"), ("form"), what are the other tags?
Arpan
look in the html...
<BODY> - body
<A HREF> - a
<FORM> - form
<TABLE> - table
etc...
it should be any of those < > tags...
Thanks Static.
Arpan
I'm trying the same thing, but using VS2010. I am getting an error after referencing MS HTML Object Library. The culpert seems to be
WebBrowser1.Application
is not a member of 'System.Windows.Forms.WebBrowser'
What can I do to avoid this error?
Welcome to VBForums :wave:
You are asking in completely the wrong place. While VB6 and VB.Net (VB 2002 and later) both have 'VB' in their names, they are very different languages.
You should post a thread in our VB.Net forum instead.
OK, thanks ... I will post in VB.NET forum