Atur Propertis pada komponen ComboBox1 dan ComboBox2 seperti gambar
dibawah ini !
ComboBox1 :
Klik Lingkaran diatas pada Items pada Propertis Componen ComboBox1 lalu isikan
seperti data di atas
ComboBox2 :
Lalu klik 2 x ComboBox1 lalu ketik listing berikut :
procedure TForm2.ComboBox1Change(Sender: TObject);
begin
if combobox1.ItemIndex = 0 then
begin
edit1.Text := combobox1.Text;
edit2.Text := 'Garuda';
end
else
if combobox1.ItemIndex = 1 then
begin
edit1.Text := combobox1.Text;
edit2.Text := 'Makassar';
end
else
if combobox1.ItemIndex = 2 then
begin
edit1.Text := combobox1.Text;
edit2.Text := 'Batam';
end;
end;
Klik 2 x ComboBox2 lalu ketik listing berikut :
procedure TForm2.ComboBox2Change(Sender: TObject);
begin
if combobox2.ItemIndex = 0 then
begin
edit1.Text := ComboBox1.Text + ComboBox2.Text;
edit3.Text := 'Makassar ke Surabaya';
end
else
if combobox2.ItemIndex = 1 then
begin
edit1.Text := ComboBox1.Text + ComboBox2.Text;
edit3.Text := 'Makassar ke jakarta';
end
else
if combobox2.ItemIndex = 2 then
begin
edit1.Text := ComboBox1.Text + ComboBox2.Text;
edit3.Text := 'Makassar ke Batam';
end;
end;
Klik 2x Button1 (Hitung) lalu ketik listing berikut:
procedure TForm2.Button1Click(Sender: TObject);
var
harga : integer;
begin
if edit1.Text = 'GMKS-SRB' Then
begin
harga := 700000 ;
edit4.Text := inttostr (harga);
end
else
if edit1.Text = 'GMKS-JKT' Then
begin
harga := 750000 ;
edit4.Text := inttostr (harga);
end
else
if edit1.Text = 'GMKS-BTM' Then
begin
harga := 800000 ;
edit4.Text := inttostr (harga);
end
else
if edit1.Text = 'BMKS-SRB' Then
begin
harga := 650000 ;
edit4.Text := inttostr (harga);
end
else
if edit1.Text = 'BMKS-JKT' Then
begin
harga := 600000 ;
edit4.Text := inttostr (harga);
end
else
if edit1.Text = 'BMKS-BTM' Then
begin
harga := 550000 ;
edit4.Text := inttostr (harga);
end
else
if edit1.Text = 'MMKS-SRB' Then
begin
harga := 900000 ;
edit4.Text := inttostr (harga);
end
else
if edit1.Text = 'MMKS-JKT' Then
begin
harga := 950000 ;
edit4.Text := inttostr (harga);
end
else
if edit1.Text = 'MMKS-BTM' Then
begin
harga := 100000 ;
edit4.Text := inttostr (harga);
end;
end;
end.
Terimakasih yaah sangat menolong😇
ReplyDelete