Antes de fazer o famoso COPIAR e COLAR interpretem bem o código, senão não ira funcionar nada do mesmo jeito. Bom estudo.
=================================================================
unit Ucad_cli;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
cbo_sexo: TComboBox;
edt_nome: TEdit;
edt_fone: TEdit;
edt_endereco: TEdit;
edt_valor_estadia: TEdit;
btn_cadastrar: TButton;
btn_mostrar_dados: TButton;
btn_sair: TButton;
chk_vip: TCheckBox;
edt_qtd_dias: TEdit;
RadioGroup1: TRadioGroup;
rbt_sim: TRadioButton;
rbt_nao: TRadioButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
btn_limpar: TButton;
procedure btn_cadastrarClick(Sender: TObject);
procedure edt_qtd_diasChange(Sender: TObject);
procedure chk_vipClick(Sender: TObject);
procedure btn_sairClick(Sender: TObject);
procedure btn_mostrar_dadosClick(Sender: TObject);
procedure btn_limparClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
ssexo,snome,sfone,sendereco,sqtd_dias,svalor_estadia,svalor_diaria,svip,spagamento:String;
iqtd_dias:integer;
rvalor_estadia:real;
implementation
{$R *.dfm}
procedure TForm1.btn_cadastrarClick(Sender: TObject);
begin
snome:=edt_nome.Text;
sfone:=edt_fone.Text;
sendereco:=edt_endereco.Text;
ssexo:=cbo_sexo.Text;
sqtd_dias:=edt_qtd_dias.Text;
if chk_vip.Checked=true then
svip:='sim';
if chk_vip.Checked=false then
svip:='nao';
if rbt_sim.Checked=true then
spagamento:='sim';
if rbt_sim.Checked=true then
spagamento:='sim';
end;
procedure TForm1.btn_limparClick(Sender: TObject);
begin
edt_nome.Clear;
edt_fone.Clear;
edt_endereco.Clear;
edt_valor_estadia.Clear;
edt_qtd_dias.Clear;
cbo_sexo.Text:='';
chk_vip.Checked:=false;
rbt_sim.Checked:=false;
rbt_nao.Checked:=false;
end;
procedure TForm1.btn_mostrar_dadosClick(Sender: TObject);
begin
edt_nome.Text:=snome;
edt_fone.Text:=sfone;
edt_endereco.Text:=sendereco;
cbo_sexo.Text:=ssexo;
edt_qtd_dias.Text:=sqtd_dias;
if svip='sim' then
chk_vip.Checked:=true;
if svip='nao' then
chk_vip.Checked:=false;
if spagamento='sim' then
;rbt_sim.Checked:=true;
if spagamento='sim' then
rbt_sim.Checked:=true;
end;
procedure TForm1.btn_sairClick(Sender: TObject);
begin
close;
end;
procedure TForm1.chk_vipClick(Sender: TObject);
begin
if edt_qtd_dias.Text='' then
edt_qtd_dias.Text:='0';
iqtd_dias:=strTOint(edt_qtd_dias.Text);
if chk_vip.Checked=true then
rvalor_estadia:=iqtd_dias*110.00;
if chk_vip.Checked=false then
rvalor_estadia:=iqtd_dias*80.00;
edt_valor_estadia.Text:=floatTOstr(rvalor_estadia);
end;
procedure TForm1.edt_qtd_diasChange(Sender: TObject);
begin
if edt_qtd_dias.Text='' then
edt_qtd_dias.Text:='0';
//diaria normal 80,00
//diaria vip 110,00
iqtd_dias:=strTOint(edt_qtd_dias.Text);
if chk_vip.Checked=true then
rvalor_estadia:=iqtd_dias*110.00;
if chk_vip.Checked=false then
rvalor_estadia:=iqtd_dias*80.00;
edt_valor_estadia.Text:=floatTOstr(rvalor_estadia);
end;
end.