title: VB.NET - Click Submit Button on Webbrowser page
body: <p>I have a html page open on my webbrowser object, I can enter username and password okay, but I'm stuck and don't know how to submit the info.  Here is the html code for the username/password submit:</p>
  
  <pre><code>&lt;div id="signin"&gt;
      &lt;h2 class="ir"&gt;
          &lt;em&gt;&lt;/em&gt;Sign in&lt;/h2&gt;
      &lt;form action="/login/" method="post"&gt;
      &lt;input id="login-url" name="login[url]" 
             type="hidden" value="/characters/" /&gt;
      &lt;input id="login-urlError" name="login[urlError]" 
             type="hidden" value="/account/?error=1" /&gt;
      &lt;fieldset&gt;
          &lt;ul&gt;
              &lt;li class="row"&gt;
                  &lt;label for="login-username"&gt;
                      Username &lt;span class="req"&gt;*&lt;/span&gt;
                  &lt;/label&gt;
                  &lt;input id="login-username" name="login[username]"
                          type="text" class="TextBox" value="" /&gt;
              &lt;/li&gt;
              &lt;li class="row"&gt;
                  &lt;label for="login-password"&gt;
                      Password &lt;span class="req"&gt;*&lt;/span&gt;
                  &lt;/label&gt;
                  &lt;input id="login-password" name="login[password]"
                         type="password" class="TextBox Password" value="" /&gt;
              &lt;/li&gt;
              &lt;li class="but"&gt;
                  &lt;input name="login[submit]" type="image" 
                         class="img" alt="Login &amp;raquo;" 
                         src="/_pub/img/hp/but-login.png" /&gt;
              &lt;/li&gt;
          &lt;/ul&gt;
      &lt;/fieldset&gt;
      &lt;/form&gt;
      &lt;p&gt;
          &lt;a href="/account/password-reset/"&gt;ACCOUNT TROUBLE?&lt;/a&gt;
      &lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I use the following to enter the username and password:</p>
  
  <pre><code>WebBrowser1.Document.GetElementById("login-username").SetAttribute("Value", Information.txtuser.Text)
  WebBrowser1.Document.GetElementById("login-password").SetAttribute("Value", Information.txtpass.Text)
  </code></pre>
  
  <p>What should I use to submit the info now? I tried getting the element by name and kept getting index out of range error, index should be -1 or 0, but it was.</p>
  
  <p>Your help would be greatly appriecated!!</p>