|
-
October 2nd, 2001, 10:53 AM
#1
Compile error
My project starts with login form, after the password validation the form1 should be load.
My question is from the following code the compile error comming.
Variable not defined.
Private Sub cmdOK_Click()
If txtPassword = "password" Then
LoginSucceeded = True
Me.Hide
Load Form1
Else
MsgBox "Invalid Password, try again!", , "Login"
txtPassword.SetFocus
SendKeys "{Home}+{End}"
End If
End Sub
Please give me some solution
Sridhar
-
October 2nd, 2001, 11:19 AM
#2
Re: variable not defined
This occur when you have a "Option Exlpicit" statement at the beginnig of code and you refer to a variable not defined with
Dim variable as ... Private variable as... Public variable as...
in your case:
LoginSucceeded seems to be the one
you should have somewhere a
Dim LoginSucceeded as boolean
However, I think you need this variable as public:
Public LoginSucceeded as boolean
and you could need it on top of code of your form (thus becoming a property of the form) or at top of a Bas module (=satndard module).
Another chance: does in your projeect exists a Form which is named "Form1"?
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
October 2nd, 2001, 11:19 AM
#3
Re: Compile error
Instead of "Load Form1" try Form1.Show
-
October 2nd, 2001, 04:31 PM
#4
Re: variable not defined
Hi Cimperiali,
Whatever you said are already there in my login form.
Give me a more clue please.
Thanks
Sridhar
-
October 3rd, 2001, 02:11 AM
#5
Re: variable not defined
Does not vb ide highlight the statement which causes the matter?
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
October 4th, 2001, 01:50 AM
#6
Re: If you are still looking for it
'you sure the name of the variable LoginSucceeded
'had two "e" when you dim it?
private Sub cmdOK_Click()
If txtPassword = "password" then
'txtPassword must be the name of a textBox (not an arry of textboxes!).
'Check for the name to match!
LoginSucceeded = true 'I copied this, so here may be the mistake: one "e" may
' be enough...
'LoginSucceeded= a boolean maybe pubblic variable
me.Hide
'this code is in a form, not in a bas/class module
Load Form1
'Form1 must be the name of a form in your project. It should not
'be the same form where this code is
else
MsgBox "Invalid Password, try again!", , "Login"
txtPassword.SetFocus
SendKeys "{Home}+{End}"
End If
End Sub
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
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
|