Ver Mensaje Individual
  #4  
Antiguo 29-11-2011
DOS DOS is offline
Miembro
NULL
 
Registrado: jul 2011
Posts: 173
Reputación: 15
DOS Va por buen camino
Despues tambien tengo esta codificacion en el primer Form

Código Delphi [-]
var
  Form1: TForm1;
  Intentos: Integer;

implementation

uses Unit2;

{$R *.dfm}

// procedimiento nuevo, abre el form 2 y esconde el form 1
procedure abre;
begin
 Form1.Hide;
 Form2.ShowModal;
end;

// procedimiento del boton.
procedure TForm1.Button1Click(Sender: TObject);
var
    apellido, contrasena: String;
    ClaveCorrecta: Boolean;
begin
    apellido := Edit1.Text;
    contrasena := Edit2.Text;
    ClaveCorrecta := False;
    edit1.Clear;
    edit2.Clear;
    Table1.First;
    edit1.SetFocus;

    while Table1.eof = false do
    begin
        if (Table1.FieldByName('Apellido').AsString = apellido) and
           (Table1.FieldByName('Clave').AsString = contrasena) then
        begin
        abre;             // llama al procedimiento abre,
        Form2.free;    //  el form 2 se cierre...
        Application.Terminate;   // aqui termina el programa
        end;
        Table1.Next;
    end;
    if not ClaveCorrecta then
    begin
        ShowMessage('Clave o Nombre Incorrectos');
        Inc(Intentos);
        if Intentos >= 3 then
        begin
        ShowMessage('Contacte con el administrador');
        Application.Terminate;
        end;
    end;

end;
 procedure TForm1.Button2Click(Sender: TObject);
begin
close; //sale del sistema
end;

procedure TForm1.Button3Click(Sender: TObject);//boton provisorio para evitar poner la clave
begin
form1.Hide;
form2.show;
end;

end.
Responder Con Cita