bueno no tengo delphi a la mano pero creo que podes hacer algo asi, probalo y siempre escribis por aca:
Código Delphi
[-]
function clave;
var
clave:string
a:integer;
begin
a:=0;
clave:='escribes aqui la clave';
if dbedit1.text = clave then
begin
form2.show;
end
else
begin
a:=a+1;
while a=3 do
begin
showmwssagw('LO SENTIMOS EL PROGRAMA SE CERRARA');
form1.close;
end;
end;
end;