Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

doing password in a simple way 2

Status
Not open for further replies.

nijan

MIS
Jul 6, 2001
9
MY

hi all..i'm working on a simple system now..
since i am a beginner and not familar with foxpro coding,
please help me on this..

i have two textbox: txtInputUser and txtInputPass.
if the user click button 'ok', the system will check User_id and Pword from a Passcheck table.
if .txtInputUser.value=User_id and .txtInputPass.value=Pword, then the user can access the system..
if not, need to retry...message box will appear...that's the scenario...
anyone ??

 
mm...i'm using project manager..that suits me much, as a beginner.. :)
 
Hi nijan,

In the click event of OK button write like following:
WITH THISFORM
IF !USED('passcheck')
SELECT 0
USE passcheck
ELSE
SELECT passcheck
ENDIF
LOCATE FOR User_id= .txtInputUser.Value
IF FOUND()
IF .txtInputPass.value=Pword
MessageBox("Continue with Application")
ELSE
MessageBox("Password Not correct, Retry")
.txtInputPass.SETFOCUS
RETURN
ENDIF
ELSE
MessageBox("Invalid User Id, Retry")
.txtInputUser.SETFOCUS
RETURN
ENDIF
.
.
.
*Proceed with application.
ENDWITH

 
Even better , (rajeevnandanmishra, no offense intended ;-)) add a new method to the form (menu option) Form\Edit method\property and put your code in there (the new method of your form, that is.) iso of the click event of the OK button.

BUt..in the click event of the OK button put the following code:

LOCAL llRetVal
llRetVal = DODEFAULT()
IF llRetVal
THIDFORM.MyNewMethod() && this is the method you just created in your form
ENDIF

RETURN llRetVal

The reason why it is better to place your code in the form and not in the click event of the OK button can be seen at the WIKI's link in my signature.

HTH,
Weedz (Wietze Veld)
My private project:And especially for VFP rookies:
 
Hi nijan,
Weedz's suggestion is good. But just modify the code given by me for Returning 0 or 1 depending on your criteria.
Because currently i am not returning any particular value with return statement and by default it assumes to be 1.

 
hi..thanks to both of you...thats really help me with my simple system.. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top