Top Banner
OBYEK COMBO BOX Pemrograman Visual
12

Obyek Combo Box

Jan 13, 2016

Download

Documents

kiril

Obyek Combo Box. Pemrograman Visual. ComboBox digunakan untuk menampilkan daftar pilihan yang ditampilkan berbentuk kombinasi antara listbox dan edit. Pengguna dapat mengisi data dalam kotak Edit atau memilih sesuai dengan daftar yang ada. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Obyek  Combo Box

OBYEK COMBO BOXPemrograman Visual

Page 2: Obyek  Combo Box

ComboBox digunakan untuk menampilkan daftar pilihan yang ditampilkan berbentuk kombinasi antara listbox dan edit.

Pengguna dapat mengisi data dalam kotak Edit atau memilih sesuai dengan daftar yang ada.

Daftar pilihan terdapat pada properti ITEMS. Dan pilihan yang dipilih oleh user dapat diakses melalui properti TEXT atau ITEMINDEX.

Page 3: Obyek  Combo Box

Contoh 1:

Hasil Tampilan Form

Page 4: Obyek  Combo Box

Listing Programprocedure TForm1.Button1Click(Sender: TObject);begin if Combobox1.Text='Mempawah' then edit1.Text:='20000' else if combobox1.Text='Singkawang' then edit1.Text:='75000' else if combobox1.Text='Sanggau' then edit1.Text:='85000' else edit1.Text:='0';end;

Page 5: Obyek  Combo Box

Contoh 2:

Tampilan Form

Page 6: Obyek  Combo Box

Listing Program

procedure TForm1.Button1Click(Sender: TObject);

Var

pjng, lbr, luas,konversi, konversiM, konversiCM : real;

begin

pjng:=strtofloat(edit2.Text);

lbr:=strtofloat(edit3.Text);

luas:=pjng*lbr;

if combobox1.Text ='M' then

edit4.Text:=floattostr(luas) + ' m'

else

edit4.Text:=floattostr(luas)+' cm';

Page 7: Obyek  Combo Box

//Menghitung Konversi

konversiM:=luas*100;

konversiCM:=luas/100;

if combobox1.Text ='M' then

edit1.Text:=floattostr(konversiM) + ' cm'

else

edit1.Text:=floattostr(konversiCM)+' m';

end;

Page 8: Obyek  Combo Box

Contoh 3

Tampilan Form

Page 9: Obyek  Combo Box

Listing Program

procedure TForm1.ComboBox1Change(Sender: TObject);

begin

if combobox1.Text = 'Direktur' then

edit2.Text:='5000000'

else

if combobox1.Text = 'Manager' then

edit2.Text:='3000000'

else

edit2.Text:='1000000';

end;

Page 10: Obyek  Combo Box

procedure TForm1.RadioButton1Click(Sender: TObject);

var gapok,tunj:real;

begin

if radiobutton1.Checked=true then

gapok:=strtofloat(edit2.Text);

tunj:=gapok*0.3;

edit3.Text:=floattostr(tunj);

end;

Page 11: Obyek  Combo Box

procedure TForm1.RadioButton2Click(Sender: TObject);

var gapok,tunj:real;

begin

if radiobutton2.Checked=true then

gapok:=strtofloat(edit2.Text);

tunj:=gapok*0.1;

edit3.Text:=floattostr(tunj);

end;

Page 12: Obyek  Combo Box

procedure TForm1.Button1Click(Sender: TObject);

var pokok,tunj,bersih : real;

begin

pokok:=strtofloat(edit2.Text);

tunj:=strtofloat(edit3.Text);

bersih:=pokok+tunj;

edit4.Text:=floattostr(bersih);

end;