Ver Mensaje Individual
  #28  
Antiguo 09-09-2008
Abuelo7 Abuelo7 is offline
Miembro
 
Registrado: ene 2006
Ubicación: Igualada(Barcelona) Spain
Posts: 51
Reputación: 21
Abuelo7 Va por buen camino
Perdona me olvidé el código.
unit saberHora;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
Close;
end;

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
var
DateTime : TDateTime;
Str : String;
pregunta : String;
begin
if key=#13 then
begin
pregunta := Edit1.Text;

if pregunta=('que hora es?') then

DateTime := Time; // store the current date and time
str := TimeToStr(DateTime); // convert the time into a string
Memo1.Lines.Add(Str);

Edit1.Text:='';

end;
begin


if pregunta=('que fecha es hoy') then
begin
DateTime := Date;
str := DateToStr(DateTime);

Memo1.Lines.Add(Str);

end;
end;
end;

end.
Responder Con Cita