VB 1 _Tugas 2

Perkalian

Private Sub CMDHitung_Click()
txt3.Text = Val(txt1.Text) * Val(txt2.Text)
End Sub

Private Sub txt1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txt2.SetFocus
End If
End Sub

Private Sub CMDKeluar_Click()
Unload Me
End Sub

Private Sub CMDBersih_Click()
txt1.SetFocus
txt1 = ” “
txt2 = ” “
txt3 = ” “
End Sub

diskon 10 %

Private Sub CMDUlangi_Click()

txtawal.SetFocus

txtawal = ” “

txtdiskon = ” “

txtakhir = ” “

End Sub

Private Sub CMDQuit_Click()

Unload Me

End Sub

Private Sub CMDHitung_Click()

txtdiskon = Val(txtawal.Text) * 0.1

txtakhir = Val(txtawal.Text) – Val(txtdiskon.Text)

End Sub

Private Sub txtawal_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtdiskon.SetFocus

End If

End Sub

kalkulator

Private Sub cmdkurang_Click()

Text4.Text = Val(text1.Text) – Val(text2.Text)

End Sub

Private Sub cmdtambah_Click()

Text3.Text = Val(text1.Text) + Val(text2.Text)

End Sub

Private Sub cmdkali_Click()

Text5.Text = Val(text1.Text) * Val(text2.Text)

End Sub

Private Sub cmdbagi_Click()

Text6.Text = Val(text1.Text) / Val(text2.Text)

End Sub

Gaji

Private Sub CMDProses_Click()

txtkotor.Text = Val(txtpokok.Text) + Val(txttunjangan.Text) – Val(txtpotongan.Text)

txtpajak.Text = Val(txtkotor.Text) * 0.1

txtditerima.Text = Val(txtkotor.Text) – Val(txtpajak.Text)

End Sub

Private Sub CMDKeluar_Click()

Unload Me

End Sub

Private Sub CMDUlang_Click()

txtpokok.SetFocus

txtpokok = ” “

txttunjangan = ” “

txtpotongan = ” “

txtkotor = ” “

txtpajak = ” “

txtditerima = ” “

End Sub

Private Sub txtpokok_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txttunjangan.SetFocus

End If

End Sub

Private Sub txttunjangan_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtpotongan.SetFocus

End If

End Sub

Advertisements

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