SHARE
TWEET

Erro com Delphi

a guest May 22nd, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. unit uCadastroDeNomes;
  2.  
  3. interface
  4.  
  5. uses
  6.   Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  7.   Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ComCtrls, Vcl.ExtCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Panel1: TPanel;
  12.     Panel2: TPanel;
  13.     edtNome: TEdit;
  14.     edtSobrenome: TEdit;
  15.     edtCPF: TEdit;
  16.     edtNasc: TDateTimePicker;
  17.     btnCadastrar: TButton;
  18.     cmbNomes: TComboBox;
  19.     Label1: TLabel;
  20.     Label2: TLabel;
  21.     Label3: TLabel;
  22.     Nomes: TLabel;
  23.     procedure btnCadastrarClick(Sender: TObject);
  24.     procedure cmbNomesChange(Sender: TObject);
  25.   private
  26.     { Private declarations }
  27.   public
  28.     { Public declarations }
  29.   end;
  30.  
  31. var
  32.   Form1: TForm1;
  33.  
  34. implementation
  35.  
  36. {$R *.dfm}
  37.  
  38. uses UnitCadastro;
  39.  
  40. procedure TForm1.btnCadastrarClick(Sender: TObject);
  41. var
  42.   objdados: Tcadastro;
  43. begin
  44.   objdados := Tcadastro.Create;
  45.   objdados.nome := edtNome.Text;
  46.   objdados.sobrenome := edtSobrenome.Text;
  47.   objdados.cpf := StrToFloat(edtCPF.Text);
  48.   objdados.datanasc := edtNasc.Date;
  49.   cmbNomes.Items.AddObject(objdados.nome);
  50. end;
  51.  
  52. procedure TForm1.cmbNomesChange(Sender: TObject);
  53. var
  54.   objdados: Tcadastro;
  55. begin
  56.   objdados:= Tcadastro(cmbNomes.Items.Objects[cmbNomes.ItemIndex]);
  57.   edtNome.Text := objdados.nome;
  58.   edtSobrenome.Text := objdados.sobrenome;
  59.   edtCPF.Text := FloatToStr(objdados.cpf);
  60.   edtNasc.Date := objdados.datanasc;
  61. end;
  62.  
  63. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top