title: Passing the password from form to another form
body: <p>I have been tasked to generate a password, and then pass it to another form to login</p>
  <pre><code>Public Class Form2
  
   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
          Dim password As String
          Dim str0 As String
          Dim str1 As String
          Dim str2 As String
  
          password = txt_fname.Text.Substring(0, 1)
          str0 = txt_fname.Text
  
          password = password + txt_fname.Text.Substring(0, 1)
          str1 = txt_fname.Text
  
          password = password + txt_lname.Text.Substring(0, 1)
          str2 = txt_lname.Text
  
          str0 = str0.Length
          str1 = str1.Length
          str2 = str2.Length
  
          MsgBox(password &amp; str0 &amp; str1 &amp; str2, MsgBoxStyle.Information)
              
          Public Class Form1
  
  
      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  
          If txt_username.Text = &quot;&quot; Then
              MsgBox(&quot;Kindly Enter Your Username!&quot;, MsgBoxStyle.Exclamation, &quot;Empty Username&quot;)
          ElseIf txt_password.Text = &quot;&quot; Then
              MsgBox(&quot;Kindly Enter Your Password!&quot;, MsgBoxStyle.Exclamation, &quot;Empty Password&quot;)
          Else
              If txt_username.Text &lt;&gt; &quot;Admin&quot; Then
                  MsgBox(&quot;Incorrect Username&quot;, MsgBoxStyle.Critical, &quot;Username not Found&quot;)
                  txt_username.Clear()
                  txt_username.Focus()
                  txt_password.Clear()
              ElseIf txt_password.Text &lt;&gt; &quot;Admin&quot; Then
                  MsgBox(&quot;Incorrect Password&quot;, MsgBoxStyle.Critical, &quot;Wrong Password&quot;)
                  txt_password.Clear()
                  txt_password.Focus()
              Else
                  Form2.Show()
                  Me.Hide()
                  txt_username.Clear()
                  txt_password.Clear()
  
              End If
  
  
          End If
  
      End Sub
  </code></pre>