Member Avatar for 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 for SeniorAlexandro

BUMP.

Member Avatar for SeniorAlexandro

BUMP AGAIN :(
Anyone can help me?

Member Avatar for 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!
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.