Computing.Net > Forums > Programming > Login form in vb

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Login form in vb

Reply to Message Icon

Name: gardenair
Date: April 23, 2004 at 10:00:45 Pacific
OS: winXp
CPU/Ram: 256
Comment:

I want to make a form where in the user shold first write his user name
& then password .If the user name and password are currect then the next
form will be load otherwise the user can't switch to nect form.
I use two button . Next & Cancel.I next button i use the following
command.

Private Sub cmdNext_Click()
If txtName.Text = sky And txtPassword.Text = 123 Then
cmdNext.Enabled = True
Form1.Hide
Form2.Show
Else
cmdNext.Enabled = False
End If
End Sub

In form Load event i use
Private Sub Form_Load()

cmdNext.Enabled = False

End Sub

When i run the form write currect name, password &press next button still
VB does't switch the next form.As well as there VB6 does't show any error
Please guide me how can't i do it.
Thnaks in advance.



Sponsored Link
Ads by Google

Response Number 1
Name: wheelspinner99
Date: April 23, 2004 at 10:47:30 Pacific
Reply:

ok, your code looks good except for one thing. the .enabled only prevents the button from being pressed so you shouldn't be able to press the next button at all. So if you can't press the next button at all then you can't trigger the cmdNext_click. Right? What you should do is remove the .enabled from both steps. Then something like this...

cmdNext_click()
If txtName.text = "sky" and txtpass.text = "123" then
form2.show
form1.hide
else
msgbox("Incorrect user info")
txtname.setfocus
endif

remember, if you use literal values like sky you must enclose them in "quotes". Otherwise VB tries to find variable values, but i'm sure you knew that. Hope this helps! BTW: when switching to another form always load the next screen first and hide the screen you are leaving after. this prevents screen flickering.


0

Response Number 2
Name: gardenair
Date: April 23, 2004 at 13:43:58 Pacific
Reply:

Thnaks nick for your nice help.Iam sure that this code will work. Again thanks that u guide me in a good & nice way.


0

Response Number 3
Name: wheelspinner99
Date: April 23, 2004 at 22:21:04 Pacific
Reply:

No problem, i too hate when people act like jerks and give no help. Let us know if it doesn't work out, we'll work on it some more!


1

Response Number 4
Name: gardenair
Date: April 24, 2004 at 02:45:52 Pacific
Reply:

Again thanks ..bundle of thnaks nick. The code is working properly .U have solved my big problem .Iam so much happy & thankful for your kind co-operation. Again 1000000 times thanks
With best regards.


-1

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Login form in vb

Master-Detail Form in VB - How? www.computing.net/answers/programming/masterdetail-form-in-vb-how/2506.html

how to make a registration form in vb? www.computing.net/answers/programming/how-to-make-a-registration-form-in-vb/19319.html

making a link with 2 forms in vb www.computing.net/answers/programming/making-a-link-with-2-forms-in-vb/7847.html