vb Code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dialog1.ShowDialog()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'open website in wb
WebBrowser1.Navigate("http://www.itslearning.com/welcome.aspx")
End Sub
Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
'select combobox item in webpage
If ComboBox2.SelectedIndex <> -1 Then
Dim element As HtmlElement = WebBrowser1.Document.GetElementById("ctl00_ContentPlaceHolder1_LoginSection1_ChooseSite_site_input")
Dim optionsElement As HtmlElement = element.GetElementsByTagName("option").Cast(Of HtmlElement).First(Function(el) el.InnerText = ComboBox2.Text)
optionsElement.SetAttribute("selected", "selected")
End If
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
'fill combobox
If WebBrowser1.ReadyState <> WebBrowserReadyState.Complete Then Return
Dim element As HtmlElement = WebBrowser1.Document.GetElementById("ctl00_ContentPlaceHolder1_LoginSection1_ChooseSite_site_input")
Dim options() As String = element.GetElementsByTagName("option").Cast(Of HtmlElement).Select(Function(el) el.InnerText).ToArray
ComboBox2.Items.AddRange(options)
End Sub
End Class