Pages

Tampilkan postingan dengan label Pemrograman Visual. Tampilkan semua postingan
Tampilkan postingan dengan label Pemrograman Visual. Tampilkan semua postingan

Latihan 6 Pemrograman Visual



unit Lat6;

interface

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

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    Button1: TButton;
    ComboBox1: TComboBox;
    Edit1: TEdit;
    RadioGroup1: TRadioGroup;
    Edit2: TEdit;
    procedure Button1Click(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure RadioGroup1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  a,b:string;
implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
edit1.Text:=(a);
edit2.Text:=(b);
end;

procedure TForm1.ComboBox1Change(Sender: TObject);
begin
combobox1.Text:='';
radiogroup1.ItemIndex:=-1;
case Combobox1.ItemIndex of
0:begin
a:='laki-laki';
b:='pemain sepakbola';
end;
end;
end;

procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
combobox1.ItemIndex:=-1;
case RadioGroup1.ItemIndex of
0:begin
a:='francesc';
b:='i want you';
end;
1:begin
a:='fabregas';
b:='i need you';
end;
2:begin
a:='soler';
b:='i love you';
end;
end;
end;
end.

Latihan 5 Pemrograman Visual

var
  Form1: TForm1;
  a,b,c,d,e:string;


procedure TForm1.ComboBox1Change(Sender: TObject);
begin
case Combobox1.ItemIndex of
0:begin
edit1.Text:='nama';
edit2.Text:='alamat';
edit3.Text:='umur';
edit4.Text:='status';
edit5.Text:='aaa';
end;
1:begin
a:='aaaa';
b:='bbbb';
c:='cccc';
d:='dddd';
e:='eeee';
end;
2:begin
a:='kkkk';
b:='llll';
c:='mmmm';
d:='nnnn';
e:='oooo';
end;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit4.Text:='';
edit5.Text:='';
edit6.Text:='';
combobox1.ItemIndex:=-1;
radiogroup1.ItemIndex:=-1;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
edit1.Text:=a;
edit2.Text:=b;
edit3.Text:=c;
edit4.Text:=d;
edit5.Text:=e;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
close;
end;

procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
Case RadioGroup1.ItemIndex of
0:begin
edit6.Text:='4';
end;
1:begin
edit6.Text:='5';
end;
2:begin
edit6.Text:='6';
end;
end;
end;
end.


Latihan 4 Pemrograman Visual



var
  Form1: TForm1;
  a,b,c:real;

procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
case radiogroup1.ItemIndex of
0:begin
a:=3500;
end;
1:begin
a:=4000;
end;
2:begin
a:=5000;
end;
end;
edit1.Text:=floattostr(a+b+c);
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if CheckBox1.Checked then
b:=2000;
edit1.Text:=floattostr(a+b+c);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
x,y,z:real;
begin
x:=strtofloat(edit1.text);
y:=strtofloat(edit2.Text);
z:=y-x;
edit3.text:=floattostr(z);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
checkbox1.Checked:=false;
a:=0;
b:=0;
c:=0;
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
radiogroup1.ItemIndex:=-1;
end;

procedure TForm1.ComboBox1Change(Sender: TObject);
begin
case combobox1.ItemIndex of
0:begin
c:=1000;
end;
end;
edit1.text:=floattostr(a+b+c);
end;
end.

Hasil Run

Latihan 2 Pemrograman Visual



RadioGroup1
begin
case radiogroup1.ItemIndex of
0:begin
f:=1000;
end;
1:begin
f:=2000;
end;
2:begin
f:=3000;
end;
end;
edit1.Text:=floattostr(d+e+f);
end;

Combobox1
begin
case combobox1.ItemIndex of
0:begin
d:=1000;
end;
1:begin
d:=2000;
end;
2:begin
d:=3000;
end;
end;
edit1.Text:=floattostr(d+e+f);
end;

Combobox2
begin
case combobox2.ItemIndex of
0:begin
e:=1000;
end;
1:begin
e:=2000;
end;
2:begin
e:=3000;
end;
end;
edit1.Text:=floattostr(d+e+f);
end;

Button Mulai Baru
begin
combobox1.Text:='';
combobox2.Text:='';
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
end;

Button Hitung
var
a,b,c:real;
begin
a:=strtofloat(edit1.Text);
b:=strtofloat(edit2.Text);
c:=b-a;
if b<a then
showmessage('uang anda kurang');
edit3.Text:=floattostr(c);
end;

Button Exit
begin
form1.Close;
end;

Latihan 1 Pemrograman Visual

procedure TForm1.Button1Click(Sender: TObject);
var
a,b,c:real;
begin
a:=strtofloat(edit6.Text);
b:=strtofloat(edit7.Text);
c:=a+b;
showmessage('Hello');
edit10.Text:=floattostr(c);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit4.Text:='';
edit5.Text:='';
edit6.Text:='';
edit7.Text:='';
edit8.Text:='';
edit9.Text:='';
edit10.Text:='';
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
edit8.text:=edit1.Text;
edit9.text:=edit2.text;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
form1.Close;
end;
end.