Member Avatar

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>

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

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

Recommended Answers

All 4 Replies

Member Avatar


Member Avatar

Anyone can help me?

Member Avatar

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, learning, and sharing knowledge.