Minggu, 02 Desember 2018

Tugas 2.6 Bahasa Pemrograman-1



Private Sub Biru_Click()
'membuat teks berwarna Biru
Hasil.ForeColor = vbBlue
End Sub

Private Sub Hijau_Click()
'membuat teks berwarna Hijau
Hasil.ForeColor = vbGreen
End Sub

Private Sub Hitam_Click()
'membuat teks berwarna Hitam
Hasil.ForeColor = vbBlack
End Sub

Private Sub Merah_Click()
'membuat teks berwarna merah
Hasil.ForeColor = vbRed
End Sub

Private Sub Tebal_Click()
'membuat teks tebal
If Tebal.Value = 1 Then
Hasil.FontBold = True
Else
Hasil.FontBold = False
End If
End Sub

Private Sub Miring_Click()
'membuat teks miring
If Miring.Value = 1 Then
Hasil.FontItalic = True
Else
Hasil.FontItalic = False
End If
End Sub

Private Sub GarisBawah_Click()
'membuat teks GarisBawah
If GarisBawah.Value = 1 Then
Hasil.FontUnderline = True
Else
Hasil.FontUnderline = False
End If
End Sub

Private Sub Coret_Click()
'membuat teks coret
If Coret.Value = 1 Then
Hasil.FontStrikethru = True
Else
Hasil.FontStrikethru = False
End If
End Sub

Private Sub Keluar_Click()
End
End Sub

Tugas 2.5 Bahasa Pemrograman-1



Private Sub Ketik_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Label2 = Ketik.Text
End If
End Sub

Private Sub OK_Click()
Label2.Caption = Ketik.Text
End Sub

Private Sub Option1_Click()
Label2.ForeColor = vbBlue
End Sub

Private Sub Option2_Click()
Label2.ForeColor = vbRed
End Sub


Private Sub Check1_Click()
Label2.FontBold = Check1.Value
End Sub

Private Sub Check2_Click()
Label2.FontItalic = Check2.Value
End Sub

Private Sub Selesai_Click()
End
End Sub

Tugas 2.4 Bahasa Pemrograman-1



Private Sub GajiPokok_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Tunjangan.SetFocus
End If
End Sub


Private Sub Tunjangan_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Potongan.SetFocus
End If
End Sub


Private Sub Potongan_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
GajiKotor = Val(GajiPokok) + Val(Tunjangan) - Val(Potongan)
Pajak = Val(GajiKotor) * 0.1
GajiBersih = Val(GajiKotor) - Val(Pajak)
End If
End Sub

Private Sub Proses_Click()
GajiKotor = Val(GajiPokok) + Val(Tunjangan) - Val(Potongan)
Pajak = Val(GajiKotor) * 0.1
GajiBersih = Val(GajiKotor) - Val(Pajak)
End Sub

Private Sub Ulang_Click()
GajiPokok.SetFocus
GajiPokok = ""
Tunjangan = ""
Potongan = ""
GajiKotor = ""
Pajak = ""
GajiBersih = ""
End Sub


Private Sub Keluar_Click()
End
End Sub

Tugas 2.3 Bahasa Pemrograman-1



Private Sub GajiPokok_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Tunjangan.SetFocus
End If
End Sub

Private Sub Tunjangan_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Potongan.SetFocus
End If
End Sub

Private Sub Proses_Click()
GajiKotor = Val(GajiPokok) + Val(Tunjangan) - Val(Potongan)
Pajak = Val(GajiKotor) * 0.1
GajiBersih = Val(GajiKotor) - Val(Pajak)
End Sub

Private Sub Ulang_Click()
GajiPokok.SetFocus
GajiPokok = ""
Tunjangan = ""
Potongan = ""
GajiKotor = ""
Pajak = ""
GajiBersih = ""
End Sub

Private Sub Keluar_Click()
End
End Sub

Tugas 2.2 Bahasa Pemrograman-1


Private Sub HargaAwal_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
HargaAwal.SetFocus
Diskon = Val(HargaAwal) * 0.1
HargaAkhir = Val(HargaAwal) - Val(Diskon)
End If
End Sub

Private Sub Hitung_Click()
Diskon = Val(HargaAwal) * 0.1
HargaAkhir = Val(HargaAwal) - Val(Diskon)
End Sub

Private Sub Ulangi_Click()
HargaAwal.SetFocus
HargaAwal = ""
Diskon = ""
HargaAkhir = ""
End Sub

Private Sub Keluar_Click()
End
End Sub

Tugas 2.1 Bahasa pemprogram-1



Private Sub Hitung_Click()
Diskon = Val(HargaAwal) * 0.1
HargaAkhir = Val(HargaAwal) - Val(Diskon)
End Sub


Private Sub Quit_Click()
End
End Sub

Private Sub Ulangi_Click()
HargaAwal.SetFocus
HargaAwal = ""
Diskon = ""
HargaAkhir = ""
End Sub

Minggu, 25 November 2018

Tugas 1.5

Private Sub Command1_Click()
Text9 = Val(Text1) + Val(Text2)
Text10 = Val(Text4) * Val(Text6)
Text11 = Val(Text3) - Val(Text7)
Text12 = Val(Text2) / Val(Text8)
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Command3_Click()
Text1.SetFocus
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
Text8 = ""
Text9 = ""
Text10 = ""
Text11 = ""
Text12 = ""
End Sub

Private Sub Text1_Keypress(Keyascii As Integer)
If Keyascii = 13 Then
Text5.SetFocus
End If
End Sub

Private Sub Text2_Keypress(Keyascii As Integer)
If Keyascii = 13 Then
Text8.SetFocus
End If
End Sub

Private Sub Text3_Keypress(Keyascii As Integer)
If Keyascii = 13 Then
Text7.SetFocus
End If

End Sub

Private Sub Text4_Keypress(Keyascii As Integer)
If Keyascii = 13 Then
Text6.SetFocus
End If
End Sub

Private Sub Text5_Keypress(Keyascii As Integer)
If Keyascii = 13 Then
Text9 = Val(Text1) + Val(Text2)
End If
End Sub

Private Sub Text6_Keypress(Keyascii As Integer)
If Keyascii = 13 Then
Text10 = Val(Text4) * Val(Text6)
End If
End Sub

Private Sub Text7_Keypress(Keyascii As Integer)
If Keyascii = 13 Then
Text11 = Val(Text3) - Val(Text7)
End If
End Sub

Private Sub Text8_Keypress(Keyascii As Integer)
If Keyascii = 13 Then
Text12 = Val(Text2) / Val(Text8)
End If
End Sub

Tugas 1.4

Private Sub Command1_Click()
Text9 = Val(Text1) + Val(Text2)
Text10 = Val(Text4) * Val(Text6)
Text11 = Val(Text3) - Val(Text7)
Text12 = Val(Text2) / Val(Text8)
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Command3_Click()
Text1.SetFocus
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
Text8 = ""
Text9 = ""
Text10 = ""
Text11 = ""
Text12 = ""
End Sub

Private Sub Text1_Keypress(Keyascii As Integer)
If Keyascii = 13 Then
Text5.SetFocus
End If
End Sub

Private Sub Text2_Keypress(Keyascii As Integer)
If Keyascii = 13 Then
Text8.SetFocus
End If
End Sub

Private Sub Text3_Keypress(Keyascii As Integer)
If Keyascii = 13 Then
Text7.SetFocus
End If

End Sub

Private Sub Text4_Keypress(Keyascii As Integer)
If Keyascii = 13 Then
Text6.SetFocus
End If
End Sub

Tugas 1.3

Private Sub cmdbersih_Click()
Txtn1.SetFocus
Txtn1 = ""
Txtn2 = ""
Txtn3 = ""
End Sub

Private Sub Cmdhitung_Click()
Txtn3 = Val(Txtn1) * Val(Txtn2)
End Sub

Private Sub cmdkeluar_Click()
End
End Sub

Private Sub Txtn1_Keypress(Keyascii As Integer)
If Keyascii = 13 Then
Txtn2.SetFocus
End If
End Sub

Private Sub Txtn2_Keypress(Keyascii As Integer)
If Keyascii = 13 Then
Txtn3 = Val(Txtn1) * Val(Txtn2)
End If
End Sub

Tugas 1.2

Private Sub cmdbersih_Click()
Txtn1.SetFocus
Txtn1 = ""
Txtn2 = ""
Txtn3 = ""
End Sub

Private Sub Cmdhitung_Click()
Txtn3 = Val(Txtn1) * Val(Txtn2)
End Sub

Private Sub cmdkeluar_Click()
End
End Sub

Private Sub Txtn1_Keypress(Keyascii As Integer)
If Keyascii = 13 Then
Txtn2.SetFocus
End If
End Sub

Private Sub Txtn2_Keypress(Keyascii As Integer)
If Keyascii = 13 Then
Txtn3.SetFocus
End If
End Sub