|
-
Nov 29th, 2005, 01:38 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] Loop Through HTML Form Elements!
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
-
Nov 29th, 2005, 02:14 PM
#2
Re: Loop Through HTML Form Elements!
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
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Nov 29th, 2005, 02:35 PM
#3
Thread Starter
Frenzied Member
Re: Loop Through HTML Form Elements!
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
-
Nov 29th, 2005, 02:39 PM
#4
Re: Loop Through HTML Form Elements!
look in the html...
<BODY> - body
<A HREF> - a
<FORM> - form
<TABLE> - table
etc...
it should be any of those < > tags...
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Nov 29th, 2005, 03:10 PM
#5
Thread Starter
Frenzied Member
Re: Loop Through HTML Form Elements!
-
Feb 27th, 2011, 10:53 AM
#6
New Member
Re: [RESOLVED] Loop Through HTML Form Elements!
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?
-
Feb 27th, 2011, 11:10 AM
#7
Re: [RESOLVED] Loop Through HTML Form Elements!
Welcome to VBForums 
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.
-
Feb 27th, 2011, 12:31 PM
#8
New Member
Re: [RESOLVED] Loop Through HTML Form Elements!
OK, thanks ... I will post in VB.NET forum
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|