Soal
Tampilan disain form
Ketentuannya:
1. Buat rumus enter untuk perpindahan dari control text yang satu ke control text yang berikutnya.
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub
2. Jumlah bayar = Harga Satuan * Jumlah barang
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text4 = Val(Text2) * Val(Text3)
Text4.SetFocus
End If
End Sub
3. Diskon ditentukan berdasarkan option :
Jika diklik 10% maka diskon = Jumlah Bayar * 10 %
Jika diklik 5% maka diskon = Jumlah Bayar * 5 %
Jika diklik 0maka diskon = 0
Private Sub Option1_Click()
If Option1.Value = True Then Text5 = Val(Text4) * 0.1
End Sub
Private Sub Option2_Click()
If Option2.Value = True Then Text5 = Val(Text4) * 0.05
End Sub
Private Sub Option3_Click()
If Option3.Value = True Then Text5 = 0
End Sub
4. Jumlah Akhir = Jumlah Bayar – Diskon
Private Sub Text5_Change()
Text6 = Val(Text4) - Val(Text5)
Text6.SetFocus
End Sub
5. Buatlah Listing untuk tomboh Lagi dan Selesai
Tombol Selesai
Private Sub Command2_Click()
Unload Me
End Sub
Tombol Lagi
Private Sub Command1_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text1.SetFocus
End Sub
Tidak ada komentar:
Posting Komentar