Hello,

I'm working on a webpage automation project. And I am very new in this. I want to use Webbrowser control to select an item in the dropdownlist. Now,how do I programmetically select an item from the HTML snippet below. I would like to select,say for example,"2009" from this HTML code :

<select name = "yr">
<option value= "">Year</option>
<option>2009</option>
<option>2010</option>
<option>2011</option>
<option>2012</option>
</select>

I am trying the following code :

      For Each element As HtmlElement In WebBrowser1.Document.GetElementsByTagName("select")
                If element.GetAttribute("name") = "yr" Then
                    element.SetAttribute("value", "2011")
                End If




    Next

Thanks in advance for any help.

I think you will have to try passing Javascript code in with your HTML stream and do it that way.

java script code will be the best to use in this case......

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.