Latihan UTS

LATHAN UTS 1

ð Form

ð Pengisian Properties

Object / Kontrol

Properti

Nilai

Label1 Caption &Kode Barang
  BackStyle 0-Transparent
Label2 Caption &Nama Barang
  BackStyle 0-Transparent
Label3 Caption &Harga
  BackStyle 0-Transparent
Label4 Caption &Quantity
  BackStyle 0-Transparent
Label5 Caption &Sub Total
  BackStyle 0-Transparent
Label6 Caption &Cek total bayar
  BackStyle 0-Transparent
Label7 Caption &Jumlah Uang
  BackStyle 0-Transparent
Label8 Caption &Kembalian
Text1 Caption Text1
Text2 Caption Text2
Text3 Caption Text3
Text4 Caption Text4
Text5 Caption Text5
Text6 Caption Text6
Text7 Caption Text7
Text8 Caption Text8
List1 Coloums 0
List2 Coloums 0
List3 Coloums 0
List4 Coloums 0
List5 Coloums 0
Command1 Caption &Simpan Barang
Command2 Caption &Transaksi Baru
Command3 Caption &Close

 

ð Code / Rumus

Private Sub Command1_Click()

List1.AddItem Text1.Text

List2.AddItem Text2.Text

List3.AddItem Text3.Text

List4.AddItem Text4.Text

List5.AddItem Text5.Text

Text6.Text = Val(Text6.Text) + Val(Text5.Text)

Text1.Text = “”

Text2.Text = “”

Text3.Text = “”

Text4.Text = “”

Text5.Text = “”

Text1.SetFocus

End Sub

 

Private Sub Command2_Click()

pesan = MsgBox(“Ulangi Transaksi Penjualan”, vbYesNo, “konfirmasi”)

If pesan = 6 Then

Form_Activate

Else

pesan = 5

End If

End Sub

Private Sub Command3_Click()

pesan = MsgBox(“Penjualan Selesai, Apakah Anda Akan Menutup Program ini,,..??”, vbOKCancel, “konfirmasi”)

If pesan = 1 Then

Unload Me

Else

pesan = 0

End If

End Sub

Private Sub Form_Activate()

Text1.Text = “”

Text2.Text = “”

Text2.Text = “”

Text3.Text = “”

Text4.Text = “”

Text5.Text = “”

Text6.Text = “”

Text7.Text = “”

Text8.Text = “”

Text1.SetFocus

List1.Clear

List2.Clear

List3.Clear

List4.Clear

List5.Clear

End Sub

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

Private Sub Text3_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Text4.SetFocus

End If

End Sub

Private Sub Text4_Change()

Text5.Text = Val(Text3.Text) * Val(Text4.Text)

End Sub

Private Sub Text7_Change()

Text8.Text = Val(Text7.Text) – Val(Text6.Text)

End Sub

Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s