Member Avatar

SeniorAlexandro

Alright, I have a Webbrowser which has a page opened. I want it to select a specific Option from the Combobox. How can I do that in VB ?

HTML Code:

<select name="Protected">
<option value="NC"></option>
<option value="ON">ON (protected)</option>
<option value="OFF">OFF (unprotected)</option>
</select>

VB Code:

For Each element As HtmlElement In Me.WebBrowser1.Document.All("Protected").GetElementsByTagName("option")
If element.GetAttribute("OFF") = "OFF (unprotected)" Then
element.SetAttribute("selected", True)
Exit For
Next

I tried it but it doesn't seem to work. What am I doing wrong?
Thanks in advance.

Member Avatar

SeniorAlexandro

BUMP.

Member Avatar

SeniorAlexandro

BUMP AGAIN :(
Anyone can help me?

Member Avatar

SeniorAlexandro

3rd Bump. Wow, can anyone help me?

Might be too late, try the following -

WebBrowser1.Document.Forms(0).elements("Protected").options(2).Selected = True

''At options(2), get what user selected, add integer then and voila!