title: Auto login to a webbrowser
body: <p>Hi I am working on a forum project, currently I have a win form that allows the user to login to the forum - this part works fine.</p>
  
  <p>After the user logs in I want a new form to open that will display the forum, how can I use the login details the user entered - pass them to the login form for the website to the user is automatically logged in so to speak</p>
  
  <p>This is the code I am using for user login</p>
  
  <pre><code>    If forumLogin.Verify(RadTextBoxUser.Text, RadTextBoxPass.Text) Then
  </code></pre>
  
  <p>I am using SMF forums not usre how I can pass RadTextBoxUser.Text and RadTextBoxPass.Text to the new form.</p>
  
  <p>I cam accros this code which looked promising </p>
  
  <pre><code> Public Class Browser
  
  
  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      'Part 1: Load Yahoo login page in Form_Load event  
      WebBrowser1.Navigate("http://websiteurl/")
  End Sub
  
  Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
      'Part 2: Locate the Username TextBox and automatically input your username  
      '&lt;INPUT class=yreg_ipt id=username maxLength=96 size=17 name=login&gt;  
      Dim theElementCollection As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("Input")
      For Each curElement As HtmlElement In theElementCollection
          Dim controlName As String = curElement.GetAttribute("id").ToString
          If controlName = "username" Then
              curElement.SetAttribute("Value", LoginForm.RadTextBoxUser.Text)
          End If
      Next
  
      'Part 3: Locate the Password TextBox and automatically input your password  
      '&lt;INPUT class=yreg_ipt id=passwd type=password maxLength=64 size=17 value="" name=passwd&gt;  
      theElementCollection = WebBrowser1.Document.GetElementsByTagName("Input")
      For Each curElement As HtmlElement In theElementCollection
          Dim controlName As String = curElement.GetAttribute("id").ToString
          If controlName = "passwd" Then
              curElement.SetAttribute("Value", LoginForm.RadTextBoxPass.Text)
          End If
      Next
  
      'Part 4: Locate the "Sign In" Button and automatically click it  
      '&lt;INPUT type=submit value="Sign In" name=.save&gt;  
      theElementCollection = WebBrowser1.Document.GetElementsByTagName("Input")
      For Each curElement As HtmlElement In theElementCollection
          If curElement.GetAttribute("value").Equals("Sign In") Then
              curElement.InvokeMember("click")
              'Javascript has a click method for we need to invoke on the current submit button element.  
          End If
      Next
  End Sub
  
  End Class
  </code></pre>
  
  <p>Code taken from <a href="http://social.msdn.microsoft.com/Forums/vstudio/en-US/0b77ca8c-48ce-4fa8-9367-c7491aa359b0/yahoo-login-via-systemnetsockets-namespace?forum=vbgeneral" rel="nofollow">http://social.msdn.microsoft.com/Forums/vstudio/en-US/0b77ca8c-48ce-4fa8-9367-c7491aa359b0/yahoo-login-via-systemnetsockets-namespace?forum=vbgeneral</a> </p>
  
  <p>I get an error when the browser loads object doesn't support this property method?</p>
  
  <p><a href="http://prntscr.com/3xygks" rel="nofollow">http://prntscr.com/3xygks</a> </p>
  
  <p>Any suggestions?</p>
  
  <p>Ok so I got it working </p>
  
  <p>On a slightly different note you used to be able to re-arrange where the forms would appear when your program runs I don't see that option in VS2012?</p>