Senin, 08 Oktober 2012

Tugas Pemrograman Visual Contoh Penggunaan Variant

Nyoba ngerjain tugas, kepepett hasilnya ngawur ga tau bener apa ga.. ehhehehehehe "yg penting ngerjain n mudah-mudahan bener :D Aminnnnn"

sebelomnya maaf kalau salah :))


Sourcode edit
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    Button2: TButton;
    procedure Edit1Change(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  V1, V2, V3, V4, V5 : Variant;
  I:Integer;
 D : Double;
  S : string;

implementation

{$R *.dfm}

procedure TForm1.Edit1Change(Sender: TObject);
begin
 V1 := 10018081;
 edit1.Text := V1;
 V2 :=  5678.9761;
 edit2.Text := V2;
 V3 := 'Siti Eka Chotimah';
 edit3.Text := V3;
 V4 := 5000;
 edit4.Text := V4;
 V5 := 8081.98047;
 edit5.Text :=V5;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Application.Terminate;
end;
end.

Sourcode button keluar
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    Button2: TButton;
    procedure Edit1Change(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  V1, V2, V3, V4, V5 : Variant;
  I:Integer;
 D : Double;
  S : string;

implementation

{$R *.dfm}

procedure TForm1.Edit1Change(Sender: TObject);
begin
 V1 := 1;
 edit1.Text := V1;
 V2 :=  1234.5678;
 edit2.Text := V2;
 V3 := 'Hello World';
 edit3.Text := V3;
 V4 := 1000;
 edit4.Text := V4;
 V5 := 2235.5678;
 edit5.Text :=V5;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Application.Terminate;
end;
end.



Tidak ada komentar:

Posting Komentar