title: Loop through listbox items
body: <p>I am making a program to automate entering data into a website  im building. I can only enter one line of data at a time. So I want to have a listbox with say 8 items, I want to take listbox item 1 enter it into an html feild with the value datafield, click send,  then navigate back to my site "mysite.com", enter listbox item 2 into datafield, click send and loop until all listbox  items have been entered.   </p>
  
  <p>If I set a textbox, this works to enter a single line a data from textbox 1, but how  could  I loop it to go go through all my listbox items. </p>
  
  <pre><code>   'Paste url  from textbox to datafield
          WebBrowser1.Document.GetElementById("datafield").SetAttribute("value", textbox1.text)
  
          'click search button
          Dim allelements As HtmlElementCollection = WebBrowser1.Document.All
  
          For Each webpageelement As HtmlElement In allelements
  
              If webpageelement.GetAttribute("type") = "submit" Then
  
                  webpageelement.InvokeMember("click")
  
              End If
  </code></pre>
  
  <p>Also is there any good way for  when I navigate back to  "mysite.com" to wait until the sites loaded to enter the next  line of data.  If there anyway you could, please take the code I posted and show me a way to paste data from the listbox to the datafield. Like enter listbox item 1 to datafield, click submit, navigate back to homepage then enter listbox item 2 in datafield click submit. and do until its at the end of the listbox  </p>