954,551 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Choose Option from Combobox in WebBrowser

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.

Aangiix3
Newbie Poster
20 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
 

BUMP.

Aangiix3
Newbie Poster
20 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
 

BUMP AGAIN :(
Anyone can help me?

Aangiix3
Newbie Poster
20 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
 

3rd Bump. Wow, can anyone help me?

Aangiix3
Newbie Poster
20 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
 

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!
AndreRet
Senior Poster
3,922 posts since Jan 2008
Reputation Points: 334
Solved Threads: 350
 

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: