title: How to use Web Browser Control in for loop?
body: <p>I am working on web crawler in which it checks the results of students from same website. I am able to submit the form and select elements but the problem is that i want to use web browser control in a loop.<br></p>
  
  <pre><code>for (int i = 3910001; i &lt; 391537; i++)
      {
        webBrowser1.Navigate(url);      
      }
  </code></pre>
  
  <p>Basically i want to navigate to url and submit the form and pick some elements from the returned <code>HTml</code>. So i used <code>webBrowser1_DocumentCompleted</code>. <br></p>
  
  <pre><code>private void webBrowser1_DocumentCompleted(object sender, 
  
      WebBrowserDocumentCompletedEventArgs e)
          {
         // MessageBox.Show("I am in completed");
  
            HtmlElement form = webBrowser1.Document.GetElementById("form1");
            webBrowser1.Document.GetElementById("RollNo").SetAttribute("value", "100");
            HtmlElement btn = webBrowser1.Document.GetElementById("Submit");
            btn.InvokeMember("click");
  
          }
  </code></pre>
  
  <p>I want to finish one document then move to other but the problem is that first the loop completes then in the end <code>webBrowser1_DocumentCompleted</code> is called only once.<br>
  Is there a solution to this problem? <br>
  Thanks</p>