|
-
Jan 21st, 2013, 07:31 AM
#1
Thread Starter
Lively Member
[RESOLVED] help!

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?
-
Jan 21st, 2013, 08:23 AM
#2
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
-
Jan 21st, 2013, 09:02 AM
#3
Addicted Member
Re: help!
VB does not use ==. It uses =. You sound like a C programmer.
-
Jan 21st, 2013, 09:10 AM
#4
Thread Starter
Lively Member
Re: help!
 Originally Posted by Edgemeal
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.
-
Jan 21st, 2013, 09:13 AM
#5
Re: help!
 Originally Posted by public
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
-
Jan 21st, 2013, 09:18 AM
#6
Thread Starter
Lively Member
Re: help!
 Originally Posted by BruceR
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. =)
-
Jan 21st, 2013, 09:26 AM
#7
Thread Starter
Lively Member
Re: help!
 Originally Posted by Edgemeal
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|