ndarisun.files.wordpress.com€¦ · Web viewDisusun untuk memenuhi tugas mata kuliah Pemrograman...
Transcript of ndarisun.files.wordpress.com€¦ · Web viewDisusun untuk memenuhi tugas mata kuliah Pemrograman...
1
LAPORAN
TUGAS 3 PEMROGRAMAN VISUAL BASIC 1
Disusun untuk memenuhi tugas mata kuliah Pemrograman visual basic1
Pada Program Pendidikan Strata Satu Jurusan Sistem Informasi
Sekolah TInggi Manajemen Informatika dan Komputer
STIMIK Pringsewu
DISUSUN OLEH:
SUNDARI
10100193
Sekolah Tinggi Manajemen Informatika dan Komputer
STIMIK Pringsewu Lampung
2011
SUNDARI(10100193)VB
2
LAPORAN
TUGAS 3 PEMROGRAMAN VISUAL BASIC 1
DISUSUN OLEH:
SUNDARI
10100193
Telah disetujui dan diterima dengan baik
Dosen Pembimbing
Nur Aminudin
NIDN 0222127602 Tanggal,,
SUNDARI(10100193)VB
3
TUGAS PRAKTIKUM 1
KODE PROGRAMPrivate Sub command1_Click()
Text1.SetFocus
Text1.Text = “”
Text2.Text = “”
Text3.Text = “”
End Sub
Private Sub command2_Click()
Unload Me
End Sub
Private Sub text_keypress(keyascii As Integer)
If keyascii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub text2_keypress(keypress As Integer)
If keyascii = 13 Then
Text3.SetFocus
End If
End Sub
TUGAS PRAKTIKUM 2
SUNDARI(10100193)VB
4
KODE PROGRAMPrivate Sub Check1_Click()
Label2.FontBold = Check1.Value
End Sub
Private Sub Check2_Click()
Label2.FontItalic = Check2.Value
End Sub
Private Sub Command1_Click()
Label2.Caption = Text1.Text
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Option1_Click()
Label2.ForeColor = vbBlue
End Sub
Private Sub Option2_Click()
Label2.ForeColor = vbRed
End Sub
TUGAS PRAKTIKUM 3
SUNDARI(10100193)VB
5
KODE PROGRAMPrivate Sub Cmdok_Click()
If (ChkTebal.Value = 1) And (ChkMiring.Value = 1) And (Chkgb.Value = 1)
Then
Text1.FontBold = True
Text1.FontItalic = True
Text1.FontUnderline = True
ElseIf (ChkTebal.Value = 1) And (ChkMiring.Value = 1) And (Chkgb.Value = 0)
Then
Text1.FontBold = True
Text1.FontItalic = True
Text1.FontUnderline = False
ElseIf (ChkTebal.Value = 1) And (ChkMiring.Value = 0) And (Chkgb.Value = 1)
Then
Text1.FontBold = True
Text1.FontItalic = False
Text1.FontUnderline = True
ElseIf (ChkTebal.Value = 1) And (ChkMiring.Value = 0) And (Chkgb.Value = 0)
Then
Text1.FontBold = True
Text1.FontItalic = False
Text1.FontUnderline = False
SUNDARI(10100193)VB
6
ElseIf (ChkTebal.Value = 0) And (ChkMiring.Value = 1) And (Chkgb.Value = 1)
Then
Text1.FontBold = False
Text1.FontItalic = True
Text1.FontUnderline = True
ElseIf (ChkTebal.Value = 0) And (ChkMiring.Value = 1) And (Chkgb.Value = 0)
Then
Text1.FontBold = False
Text1.FontItalic = True
Text1.FontUnderline = False
ElseIf (ChkTebal.Value = 0) And (ChkMiring.Value = 0) And (Chkgb.Value = 1)
Then
Text1.FontBold = False
Text1.FontItalic = False
Text1.FontUnderline = True
ElseIf (ChkTebal.Value = 0) And (ChkMiring.Value = 0) And (Chkgb.Value = 0)
Then
Text1.FontBold = False
Text1.FontItalic = False
Text1.FontUnderline = False
End If
End Sub
Private Sub Label1_Click()
End Sub
TUGAS PRAKTIKUM 4
SUNDARI(10100193)VB
7
KODE PROGRAMPrivate Sub Command2_Click()
Text3.Text = Val(Text1.Text) - Val(Text2.Text)
End Sub
Private Sub Command3_Click()
Text3.Text = Val(Text1.Text) * Val(Text2.Text)
End Sub
Private Sub Command4_Click()
Text3.Text = Val(Text1.Text) / Val(Text2.Text)
End Sub
Private Sub Command5_Click()
Text1 = ""
Text2 = ""
Text3 = ""
End Sub
Private Sub Command6_Click()
End
End Sub
TUGAS PRAKTIKUM 5
SUNDARI(10100193)VB
8
KODE PROGRAM
Private Sub Form1_Click()
Text1.SetFocus
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
End Sub
Private Sub Command1_Click()
Dim Hg, JP As Integer
Dim TB As Long
Hg = Val(Text3.Text)
JP = Val(Text4.Text)
TB = (Hg * JP)
Text5.Text = TB
Text5.SetFocus
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
SUNDARI(10100193)VB
9
Text4.Text = ""
Text5.Text = ""
End Sub
Private Sub Command3_Click()
Unload Me
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
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text4.SetFocus
End If
End Sub
TUGAS PRAKTIKUM 6
SUNDARI(10100193)VB
10
KODE PROGRAM
Private Sub Cmdhitung_Click()
Dim A, B, C As Double
TXTA.Text = Val(TXTA.Text) * 0.1
TXTC.Text = Val(TXTA.Text) - Val(TXTB.Text)
End Sub
Private Sub Cmdquit_Click()
Unload Me
End Sub
Private Sub Cmdulangi_Click()
TXTA.Text = ""
TXTB.Text = ""
TXTC.Text = ""
End Sub
Private Sub TXTA_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TXTB.SetFocus
End If
End Sub
Private Sub TXTB_Change()
If KeyAscii = 13 Then
TXTC.SetFocus
End If
SUNDARI(10100193)VB
11
End Sub
TUGAS PRAKTIKUM 7
KODE PROGRAMPrivate Sub CMDKELUAR_Click()
Unload Me
End Sub
Private Sub CMDPROSES_Click()
Dim A, B, C, D, E, F As Double
TXTD.Text = Val(TXTA.Text) + Val(TXTB.Text) - Val(TXTC.Text)
TXTE.Text = Val(TXTD.Text) * (0.1)
TXTF.Text = Val(TXTD.Text) - Val(TXTE.Text)
End Sub
Private Sub CMDULANG_Click()
TXTA.Text = ""
TXTB.Text = ""
TXTC.Text = ""
TXTD.Text = ""
SUNDARI(10100193)VB
12
TXTE.Text = ""
TXTF.Text = ""
End Sub
Private Sub TXTA_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TXTB.SetFocus
End If
End Sub
Private Sub TXTB_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TXTC.SetFocus
End If
End Sub
TUGAS PRAKTIKUM 8
SUNDARI(10100193)VB
13
KODE PROGRAM
Private Sub Combo1_Click()
Dim nama, jurusan As String
Select Case Combo1.Text
Case "10100193"
nama = "SUNDARI"
jurusan = "SISTEM INFORMASI"
Case "10201210"
nama = "PUSPIATI"
jurusan = "LPP STARTECH COMPUTER"
Case "10201431"
nama = "SUSANTO"
jurusan = "MANAJEMEN INFORMATIKA"
End Select
Text1.Text = nama
Text2.Text = jurusan
Text3.SetFocus
End Sub
Private Sub Command1_Click()
Dim QUIS, TGS, UTS, UAS, NA As Integer
Dim HM As String
QUIS = Val(Text3.Text)
SUNDARI(10100193)VB
14
TGS = Val(Text4.Text)
UTS = Val(Text5.Text)
UAS = Val(Text6.Text)
NA = (QUIS + TGS + UTS + UAS) / 4
Text7.Text = NA
Select Case Text7.Text
Case Is > 80
HM = "A"
Case Is > 70
HM = "B"
Case Is > 60
HM = "C"
Case Is > 50
HM = "D"
Case Is < 50
HM = "E"
End Select
Text8.Text = HM
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Combo1.Text = ""
End Sub
Private Sub Command3_Click()
Unload Me
SUNDARI(10100193)VB
15
End Sub
Private Sub Form_Load()
Combo1.AddItem "10100193"
Combo1.AddItem "10201210"
Combo1.AddItem "10201431"
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text4.SetFocus
End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text5.SetFocus
End If
End Sub
Private Sub Text5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text6.SetFocus
End If
End Sub
TUGAS PRAKTIKUM 9
SUNDARI(10100193)VB
16
KODE PROGRAMPrivate Sub Cbgolongan_Click()
Dim GAPOK, PAJAK, TUNJANGAN, total As Variant
Select Case Cbgolongan.Text
Case "I"
GAPOK = 1500000
TUNJANGAN = 150000
Case "II"
GAPOK = 2000000
TUNJANGAN = 200000
Case "III"
GAPOK = 2500000
TUNJANGAN = 250000
Case "IV"
GAPOK = 3000000
TUNJANGAN = 300000
End Select
total = (GAPOK + TUNJANGAN)
PAJAK = (total) * 0.1
Text3.Text = GAPOK
Text4.Text = TUNJANGAN
Text5.Text = PAJAK
Text6.Text = total - PAJAK
SUNDARI(10100193)VB
17
Text6.Text = total
End Sub
Public Sub KOSONG()
Text1.SetFocus
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Cbgolongan.Text = ""
End Sub
Private Sub Command1_Click()
KOSONG
End Sub
Private Sub Command2_Click()
KOSONG
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_load()
Cbgolongan.AddItem "I"
Cbgolongan.AddItem "II"
Cbgolongan.AddItem "III"
Cbgolongan.AddItem "IV"
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
SUNDARI(10100193)VB
18
TUGAS PRAKTIKUM 10
KODE PROGRAMPrivate Sub Command1_Click()
Dim S As String
Text5.Text = "20" & Left(Text2.Text, 2)
S = Mid(Text2.Text, 3, 1)
If S = "2" Then
Text3.Text = "Manajemen Informatika"
ElseIf S = "1" Then
Text3.Text = "Sistem Informasi"
End If
S = Mid(Text2.Text, 4, 2)
If S = "00" Then
Text4.Text = "Strata Satu S1"
ElseIf S = "02" Then
Text4.Text = "Diploma Tiga D3"
End If
SUNDARI(10100193)VB
19
Text6.Text = Right(Text2.Text, 3)
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text1.SetFocus
End Sub
Private Sub Command3_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Form_Activate()
Text1.SetFocus
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
SUNDARI(10100193)VB
20
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
SUNDARI(10100193)VB