hi i need to write a logon code for delphi 7 that logs on to someone and then if they get the password wrong 3 time they get locked out. i am completely stuck i have a log on code written but i don't know where to go after that. the log on code is
procedure TForm1.Button1Click(Sender: TObject);
var
count: integer;
begin
If edit1.Text='Jayno4' Then
Begin
Edit1.Readonly:=true;
end
else
If MaskEdit1.Text='jaynesh' Then
Begin
form3.Visible:=True;
end
else
Begin
ShowMessage('Incorrect username and password');
end;
end;

end

Recommended Answers

All 3 Replies

What do you want?To log into a computer or just your program?

What do you want?To log into a computer or just your program?

basically on a form there is a button called log in and what happens is when the people put the right details in to the edit box and the mask edit it logs them in and shows them a new form but if they get it wrong they get another try and after 3 tries i need it to close the application and show message saying you have now been locked out. the main part i am stuck at is trying to make it give the person 3 tries

one alternative is

procedure TForm1.Button1Click(Sender: TObject);
var
count: integer;
begin {main}
	count:=3;
	If edit1.Text='Jayno4' Then
	Begin
		Edit1.Readonly:=true;
	end else	if MaskEdit1.Text='jaynesh' Then
	Begin
		form3.Visible:=True;
	end else Begin
		Dec(count);{same as count:=count-1}
		ShowMessage('Incorrect username and password');
		if (count=0) then begin
			ShowMessage('Program is exiting...');
			sleep(200);
			close;
		end;
	end;
end;{of main}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.