Results 1 to 7 of 7

Thread: [RESOLVED] help!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2011
    Posts
    105

    Resolved [RESOLVED] help!

    Name:  xmdcK36.png
Views: 172
Size:  121.6 KB

    this is my form1, can any1 help me with the login form here, i want to make it in such a way that
    if login=s1002 and password=pass123, it will open form2
    if login=s2002 and password=pass123, it will open form3
    if login=s3003 and password=pass123, it will open form4

    so this is my current code to open form2
    Code:
    Private Sub Submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Submit.Click
            If TextBoxLogin== "s1001" && TextBoxPassword=="pass123"
                Dim theform As New Form2
                theform.ShowDialog()
            End If
        End Sub
    End Class
    the submit_click is the submit button, and i got a expression expected error at the "=" from
    Code:
    If TextBoxLogin== "s1001"
    can any1 help me to correct the error and check whether i am doing it correctly?

  2. #2
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: help!

    Is that VB.net code? try something more like...
    Code:
    If TextBoxLogin.Text = "s1001" AndAlso TextBoxPassword.Text = "pass123" Then
    ' do something
    End If

  3. #3
    Addicted Member
    Join Date
    Sep 2009
    Posts
    130

    Re: help!

    VB does not use ==. It uses =. You sound like a C programmer.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Aug 2011
    Posts
    105

    Re: help!

    Quote Originally Posted by Edgemeal View Post
    Is that VB.net code? try something more like...
    Code:
    If TextBoxLogin.Text = "s1001" AndAlso TextBoxPassword.Text = "pass123" Then
    ' do something
    End If
    thanks, this is what i wanted! =)
    i am new to vb.net.

    by the way is it possible to implement the password to be hidden?, like using *** or dots.

  5. #5
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: help!

    Quote Originally Posted by public View Post
    thanks, this is what i wanted! =)
    i am new to vb.net.

    by the way is it possible to implement the password to be hidden?, like using *** or dots.
    Yep, see TextBox.PasswordChar Property

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Aug 2011
    Posts
    105

    Re: help!

    Quote Originally Posted by BruceR View Post
    VB does not use ==. It uses =. You sound like a C programmer.
    sorry i learned a little about c++ earlier on, i thought it uses similar languages.
    i am new to vb.net by the way. =)

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Aug 2011
    Posts
    105

    Re: help!

    Quote Originally Posted by Edgemeal View Post
    thanks again Edgemeal, +repped you.
    Last edited by public; Jan 21st, 2013 at 10:34 AM. Reason: solved my previous question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width