Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Password mask character?
Message
From
27/04/2016 18:44:39
 
 
To
27/04/2016 10:23:03
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8.1
Network:
Windows Server 2008 R2
Database:
Visual FoxPro
Application:
Desktop
Virtual environment:
VMWare
Miscellaneous
Thread ID:
01635470
Message ID:
01635516
Views:
70
Hi Albert
this is a code answering to your question.issue" foxpro" (userid) and password="rock"
Note :
run/n charmap
can find a circle black symbol (or others ones) with a specific font here.
*a VFP classic modal form to desserve login with one  userId and one password.
*userID=foxpro   password=rock

Publi yform
yform=Newobject("login")
yform.Show
Retu
*
Define Class login As Form
	DataSession = 2
	BorderStyle = 2
	Top = 0
	Left = 0
	Height = 113
	Width = 397
	DoCreate = .T.
	Caption = "Enter Password"
	MaxButton = .F.
	MinButton = .F.
	WindowType = 1
	BackColor = Rgb(212,208,200)
*-- Holds User Name of a successful login to be returned to the calling form or program.
	cuser = ""
	Userid = .F.
	Password = .F.
	Name = "Form1"

	Add Object txtusername As TextBox With ;
		FontBold = .F., ;
		FontName = "MS Sans Serif", ;
		FontSize = 8, ;
		Height = 23, ;
		Left = 78, ;
		TabIndex = 2, ;
		Top = 42, ;
		Width = 223, ;
		Name = "txtUserName"

	Add Object txtpassword As TextBox With ;
		FontBold = .T., ;
		FontName = "webdings", ;
		FontSize = 8, ;
		Height = 23, ;
		Left = 78, ;
		TabIndex = 4, ;
		Top = 73, ;
		Width = 223, ;
		PasswordChar =Chr(61),;
		Name = "txtPassword"

	Add Object label1 As Label With ;
		AutoSize = .T., ;
		FontBold = .F., ;
		FontName = "MS Sans Serif", ;
		FontSize = 8, ;
		BackStyle = 0, ;
		Caption = "\<User Name:", ;
		Height = 15, ;
		Left = 12, ;
		Top = 46, ;
		Width = 58, ;
		TabIndex = 1, ;
		Name = "Label1"

	Add Object label2 As Label With ;
		AutoSize = .T., ;
		FontBold = .F., ;
		FontName = "MS Sans Serif", ;
		FontSize = 8, ;
		BackStyle = 0, ;
		Caption = "\<Password:", ;
		Height = 15, ;
		Left = 12, ;
		Top = 77, ;
		Width = 51, ;
		TabIndex = 3, ;
		Name = "Label2"

	Add Object cmdok As CommandButton With ;
		Top = 11, ;
		Left = 314, ;
		Height = 23, ;
		Width = 72, ;
		FontBold = .F., ;
		FontName = "MS Sans Serif", ;
		FontSize = 8, ;
		Caption = "OK", ;
		TabIndex = 5, ;
		Name = "cmdOK"

	Add Object cmdcancel As CommandButton With ;
		Top = 40, ;
		Left = 314, ;
		Height = 23, ;
		Width = 72, ;
		FontBold = .F., ;
		FontName = "MS Sans Serif", ;
		FontSize = 8, ;
		Cancel = .T., ;
		Caption = "Cancel", ;
		TabIndex = 6, ;
		Name = "cmdCancel"

	Add Object label3 As Label With ;
		AutoSize = .T., ;
		FontName = "MS Sans Serif", ;
		FontSize = 8, ;
		BackStyle = 0, ;
		Caption = "Enter your password for database access.", ;
		Height = 15, ;
		Left = 12, ;
		Top = 13, ;
		Width = 200, ;
		TabIndex = 0, ;
		Name = "Label3"

	Procedure Load
	This.AutoCenter = .T.
	This.BorderStyle = 2 && Fixed Dialog
	Endproc

	Procedure Unload
	Return This.cuser
	Endproc

	Procedure Init
	With Thisform
		.Userid="foxpro"
		.Password="rock"
	Endwith
	Endproc

	Procedure txtpassword.KeyPress
	Lparameters nKeyCode, nShiftAltCtrl
	If nKeyCode = 13 && Enter
		Nodefault
		Thisform.cmdok.Click
	Endif
	Endproc

	Procedure cmdok.Click
	If Upper(Thisform.Userid) ==Upper(Alltrim(Thisform.txtusername.Value)) And Alltrim(Thisform.Password) == Alltrim(Thisform.txtpassword.Value)
		Thisform.cuser = Alltrim(Thisform.Userid)
		Thisform.Release
	Else
		#Define MISMATCH_LOC "The user name or password is incorrect. Please try again."
		Wait Window MISMATCH_LOC Timeout 1.5
		Thisform.txtusername.Value = ""
		Thisform.txtpassword.Value = ""
		Thisform.txtusername.SetFocus
	Endif
	Endproc

	Procedure cmdcancel.Click
	Thisform.cuser = ""
	Thisform.Release
	Endproc

Enddefine
*
*-- EndDefine: login
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform