|
-
Nov 19th, 1999, 09:38 AM
#1
Thread Starter
Registered User
Hello i am having some problems i tried de-bugging the problem but i am just learning how to debug properly i have found out that the values of Pass and UserName go to "" after like the 4th try it works somtimes and then it stops here is the CODE:
Code:
Private Sub Command1_Click()
Dim Pass As String, UserName As String
Pass = txtPass.Text
UserName = txtUser.Text
If UserName = "Cory" And Pass = "hello" Then
MsgBox "PassWord Confirmed", 12, "Thank You"
Load Form1
Form1.Show
frmPass.Visible = False
Else
MsgBox "Incorrect Password", 8, "Please try again"
End If
End Sub
can someone please tell me what i am doing wrong in this code? the password program opens when the program is first ran.. . it comes up and then u must enter a username and then a passsword the text boxes are named:
txtUser 'user name
txtPass 'Password
THanks for your time!
------------------
Cory Sanchez
Young Student
ICQ#: 18640149
-
Nov 19th, 1999, 08:02 PM
#2
Addicted Member
This seems to work
Private Sub Command1_Click()
Dim Pass As String, UserName As String
Pass = txtPass
UserName = txtUser
If UserName = "Cory" And Pass = "hello" Then
MsgBox "PassWord Confirmed", 12, "Thank You"
Form1.Show
Unload Me
Else
MsgBox "Incorrect Password", 8, "Please try again"
txtUser = ""
txtPass = ""
End If
End Sub
-
Nov 20th, 1999, 03:28 AM
#3
Addicted Member
Notice that I unloaded the password form and set the text boxes to null. By
your not unloading the password form, it remained in memory and this is not
good. Also by not
setting the text in the textboxes to null, their values were maintained in
memory locations that could not be reassigned every so many times you ran
through it.
I hope this helps, and you don't need the Text extension on a textbox, i.e.,
Pass = txtPass as Text is the default for textboxes as caption is the
default for labels,
i.e., Label5.Caption = "Cory" is the same as Label5 = Cory
-
Nov 20th, 1999, 12:19 PM
#4
Thread Starter
Registered User
Thanks for your help! but why wouldn't my code work? it all seemed to fit in right . . . Pass = txtPass.text why would that stop working after like the 5th try but Pass = txtPass worked?
------------------
Cory Sanchez
Young Student
ICQ#: 18640149
-
Nov 20th, 1999, 12:29 PM
#5
Thread Starter
Registered User
Thanks for your help! but why wouldn't my code work? it all seemed to fit in right . . . Pass = txtPass.text why would that stop working after like the 5th try but Pass = txtPass worked?
------------------
Cory Sanchez
Young Student
ICQ#: 18640149
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
|