Langkah – langkah pembuatan
program :
· Buka proyek Standard EXE yang baru
· Disain tampilan form seperti gambar berikut
dengan menggunakan objek Label, TextBox, CommandButton, Frame dan OptionButton
Gbr 1
·
Atur Properties masing - masing kontrol seperti
dibawah ini :
Kontrol
|
Properties
|
Pengaturan
|
TextBox1
|
Name
Caption
Font
ForeColor
|
txt_harga
(dikosongkan)
MS Sans Serif, Bold,
10
&H00FF0000&
|
CommandButton1
|
Name
Caption
|
cmd_exit
E&xit
|
Label1
|
Caption
Font
ForeColor
|
Harga Barang
MS Sans Serif, Bold,
10
&H00FF0000&
|
Label2
|
Caption
Font
ForeColor
|
Discount
MS Sans Serif, Bold,
10
&H00FF0000&
|
Label3
|
Caption
Font
ForeColor
|
Total Harga (Harga
Barang - Discount) :
MS Sans Serif, Bold,
10
&H00FF0000&
|
Label4
|
Name
Caption
Font
ForeColor
|
lbl_discount
(dikosongkan)
MS Sans Serif, Bold,
10
&H00FF0000&
|
Label5
|
Name
Caption
Font
ForeColor
|
lbl_total
(dikosongkan)
MS Sans Serif, Bold,
10
&H00FF0000&
|
Frame
|
Name
Caption
|
Frame1
Discount 10%
|
Form1
|
Name
Caption
|
frm_CheckBox
Program Penjualan Dengan Menggunakan Objek OptionButton
|
· Double click pada OptionButton OptYa lalu
ketik kode program dibawah ini :
Private Sub OptYa_Click()
Me.lbl_discount.Caption = Me.txt_harga.Text * 0.1
Me.lbl_total.Caption = Me.txt_harga.Text - Me.lbl_discount.Caption
End Sub
· Double click pada
OptionButton OptTidak lalu ketik kode program dibawah ini :
Private Sub OptTidak_Click()
Me.lbl_discount.Caption = 0
Me.lbl_total.Caption = Me.txt_harga.Text - Me.lbl_discount.Caption
End Sub
· Double click pada CommandButton cmd_exit lalu ketik kode program di bawah ini :
Private Sub cmd_exit_Click()
End
End Sub
· Jalankan Program dengan cara menekan tombol F5
pada keyboard atau pilih menu Run =>
Start
Download
Program Penjualan Dengan Menggunakan Objek OptionButton disini
Tidak ada komentar:
Posting Komentar
Pos kan komentar anda !