how to handle html's select with webbrowser?

 Dim i As Integer, j As Integer
        With WebBrowser1.Document
            For i = 0 To .All.Count - 1
                If .All(i).Id = "GeoCode" Then
                    For j = 0 To .All(i).Children.Count - 1
                        If iniGeoCode.ToString = .All(i).Children(j).GetAttribute("value").ToString Then
                            .All(i).Children(j).SetAttribute("selected", Nothing)
                        End If
                    Next
                    MsgBox(.All(i).OuterHtml)
                End If
            Next

       End With

 

i could not get the selected reset from initialized 1st select item. the setAttribute("selected",nothing) wont work for .All(i).Children(j).GetAttribute("value").ToString = 12345(for example and the condition is correctly met).  any comments thx for vb gurus' inputs.




Answer this question

how to handle html's select with webbrowser?

  • Michael Ruminer

    the problem solved. c the following codes.

    If iniGeoCode.ToString = .All(i).Children(j).GetAttribute("value").ToString Then
    .All(i).Children(j).SetAttribute("selected", True)
    Else
    .All(i).Children(j).SetAttribute("", Nothing)
    End If



  • how to handle html's select with webbrowser?