Edit Receber Valor de Outro Edit Utilizando Condições
Tenho um valor no Edit1, quero que o mesmo valor apareça no edit2 se ele for maior que 100, caso contrario apareça um texto.
Se alguem puder ajudar, estou usando delphi 7.
Se alguem puder ajudar, estou usando delphi 7.
Ciro_cj
Curtidas 0
Respostas
Joaoshi
15/03/2006
No onExit do edit1
if edit1.text > 100 then
Edit2.text := edit1.text
else
Edit2.Text := ´Sua mensagem´;
Voçê deve verificar o conteudo do edit1.text (se é numero).
Espero ter ajudado.
if edit1.text > 100 then
Edit2.text := edit1.text
else
Edit2.Text := ´Sua mensagem´;
Voçê deve verificar o conteudo do edit1.text (se é numero).
Espero ter ajudado.
GOSTEI 0
Joaoshi
15/03/2006
No onExit do edit1
if edit1.text > 100 then
Edit2.text := edit1.text
else
Edit2.Text := ´Sua mensagem´;
Voçê deve verificar o conteudo do edit1.text (se é numero).
Espero ter ajudado.
if edit1.text > 100 then
Edit2.text := edit1.text
else
Edit2.Text := ´Sua mensagem´;
Voçê deve verificar o conteudo do edit1.text (se é numero).
Espero ter ajudado.
GOSTEI 0
Ciro_cj
15/03/2006
Me ajudou muito mas agora estou com om outro problema parecido usando strings se der o valor quero que faza o caulculo caso contrario mostre o testo. segur o codigo para vcc> obrigado
O que esta errado neste código?
unit Energia_pas;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
LeituraAnterior: TEdit;
LeituraAtual: TEdit;
Consumo: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
BtnCalcula: TButton;
BtnLimpa: TButton;
BtnFechar: TButton;
Label5: TLabel;
TotalFatura: TEdit;
Label6: TLabel;
ConsEx: TEdit;
Label4: TLabel;
Label7: TLabel;
procedure BtnCalculaClick(Sender: TObject);
procedure BtnFecharClick(Sender: TObject);
procedure BtnLimpaClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Atual,Anterior,Resultado,Ce,tf:Real;
implementation
{$R *.dfm}
procedure TForm1.BtnCalculaClick(Sender: TObject);
begin
Atual:=StrToFloat(LeituraAtual.text);
Anterior:=StrToFloat(LeituraAnterior.text);
Resultado:=Atual-Anterior;
Consumo.Text:=FloatToStr(resultado);
ce:=Atual-anterior-(100);
if ce >100 then
ConsEx.Text:=FloatToStr(ce);
else
ConsEx.Text:=´Não Tributado
tf:=ce*2
if tf >0 then
Totalfatura.Text:=FloatToStr(tf);
else
totalfatura.Text:=´Sem Valor Comercial´
end;
procedure TForm1.BtnFecharClick(Sender: TObject);
begin
close;
end;
procedure TForm1.BtnLimpaClick(Sender: TObject);
begin
Leituraanterior.Text:=´´;
LeituraAtual.Text:=´´;
Consumo.Text:=´´;
LeituraAnterior.SetFocus;
end;
end.
O que esta errado neste código?
unit Energia_pas;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
LeituraAnterior: TEdit;
LeituraAtual: TEdit;
Consumo: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
BtnCalcula: TButton;
BtnLimpa: TButton;
BtnFechar: TButton;
Label5: TLabel;
TotalFatura: TEdit;
Label6: TLabel;
ConsEx: TEdit;
Label4: TLabel;
Label7: TLabel;
procedure BtnCalculaClick(Sender: TObject);
procedure BtnFecharClick(Sender: TObject);
procedure BtnLimpaClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Atual,Anterior,Resultado,Ce,tf:Real;
implementation
{$R *.dfm}
procedure TForm1.BtnCalculaClick(Sender: TObject);
begin
Atual:=StrToFloat(LeituraAtual.text);
Anterior:=StrToFloat(LeituraAnterior.text);
Resultado:=Atual-Anterior;
Consumo.Text:=FloatToStr(resultado);
ce:=Atual-anterior-(100);
if ce >100 then
ConsEx.Text:=FloatToStr(ce);
else
ConsEx.Text:=´Não Tributado
tf:=ce*2
if tf >0 then
Totalfatura.Text:=FloatToStr(tf);
else
totalfatura.Text:=´Sem Valor Comercial´
end;
procedure TForm1.BtnFecharClick(Sender: TObject);
begin
close;
end;
procedure TForm1.BtnLimpaClick(Sender: TObject);
begin
Leituraanterior.Text:=´´;
LeituraAtual.Text:=´´;
Consumo.Text:=´´;
LeituraAnterior.SetFocus;
end;
end.
GOSTEI 0