Results 1 to 1 of 1
Mar 19, 2004, 23:57 #1
- Join Date
- Mar 2004
- Lee's Summit, MO - USA
- 0 Post(s)
- 0 Thread(s)
Retrieving VALUE and TEXT withing a <SELECT> tag
I've slowly been delving into using the WebBrowser control to build an application that controls navigation and data retrival of a web site using VB. I need to know how to 'parse' the contents within a <select>..</select> tag pair (actually, <option>..</option> tags) so I can retrieve the entire values of the VALUE and TEXT properties. I want to recreate the values within a web <select>..</select> into a VB Combo Box.
I've played with getElementsByTagName and collecting all <option> tag objects. I can then get the .value and .text properties of each object in the collection, but I haven't found a way to define the name of the parent <select> tag. This is needed in case there is more than one <select>..</select>. Also, I need to take into account that the <option> tags may be the children of an <optgroup>, in which case, I believe, the parent of the <option> is the <optgroup>. In this case I'd still want to retrieve ALL <option> tag references.
An example is:
<option value="-1">Please make a selection</option>
<option value="1">Selection 1</option>
<option value="2">Selection 1</option>
<option value="3">Selection 1</option>
<option value="4">Selection 1</option>
In this example, I'd need to identify all option values and text that are children of "q"