TUGAS VB
14 MarPrivate Sub Command1_Click()
Dim snpm As String
snpm = InputBox(“npm:”)
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find “npm =” & snpm & “”
End Sub
Private Sub Command3_Click()
Text1.SetFocus
Adodc1.Recordset.AddNew
End Sub
Private Sub Command4_Click()
Adodc1.Recordset.Update
MsgBox “data berhasil disimpan. . . ! ! !”, vbOKOnly + vbInformation, “konfirmasi”
End Sub
Private Sub Command5_Click()
If MsgBox(“apakah anda yakin ingin menghapusnya. . . ???”, vbokancel + vbCritical, “konfirmasi”) = vbOK Then
Adodc1.Recordset.Delete
End Sub
Private Sub Command6_Click()
End
End Sub
Private Sub Form_Activate()
Text1.Text = “”
Text2.Text = “”
Text3.Text = “”
Text4.Text = “”
Text5.Text = “”
Text6.Text = “”
End Sub
tugas VB : No. 8
15 FebPrivate Sub cmdbatal_Click()
cbo.SetFocus
cbo.Text = “”
txta.Text = “”
txtb.Text = “”
txtc.Text = “”
txtd.Text = “”
txte.Text = “”
End Sub
Private Sub cmdkeluar_Click()
End
End Sub
Private Sub cmdlagi_Click()
cbo.SetFocus
cbo.Text = “”
txta.Text = “”
txtb.Text = “”
txtc.Text = “”
txtd.Text = “”
txte.Text = “”
End Sub
Private Sub cmdproses_Click()
Dim jb, pg, tt As String
Dim pt, hg As Variant
txtc.Text = “20″ & Mid(cbo.Text, 5, 2)
a = Left(cbo.Text, 3)
If a = “sim” Then
jb = “sistem informasi management”
pg = “fadiya ulfa”
hg = “75900″
ElseIf a = “edp” Then
jb = “elektronic data processing”
pg = “nurul agustina”
hg = “62000″
ElseIf a = “mnj” Then
jb = “manajemen”
pg = “rian hidayat”
hg = “42000″
ElseIf a = “cdr” Then
jb = “coreldraw”
pg = “siti nur khotimah”
hg = “53000″
ElseIf a = “rpl” Then
jb = “rekayasa perangkat lunak”
pg = “winda erlianti”
hg = “83000″
End If
txta.Text = jb
txtb.Text = pg
txte.Text = hg
a = Right(cbo.Text, 1)
If a = “a” Then
pt = “andi offset yogyakarta”
ElseIf a = “i” Then
pt = “indah surabaya”
ElseIf a = “s” Then
pt = “selemba empat”
ElseIf a = “e” Then
pt = “elek media komputindo”
ElseIf a = “m” Then
pt = “maxicom”
End If
txtd.Text = pt
End Sub
Private Sub Form_Load()
cbo.AddItem “sim-09-a”
cbo.AddItem “edp-10-i”
cbo.AddItem “mnj-11-s”
cbo.AddItem “cdr-12-e”
cbo.AddItem “rpl-13-m”
End Sub
tugas VB : No.5
13 FebPrivate Sub Command1_Click()
Dim a As String
tahun.Text = “20″ & Left(NPM.Text, 2)
a = Mid(NPM.Text, 3, 1)
If a = “1″ Then
jr = “sistem informasi”
ElseIf a = “2″ Then
jr = “manajemen informatika”
ElseIf a = “3″ Then
jr = ” teknik informatika”
ElseIf a = “4″ Then
jr = “komputer akuntansi”
End If
jurusan.Text = jr
a = Mid(NPM.Text, 4, 2)
If a = “01″ Then
ps = “strata satu”
ElseIf a = “02″ Then
ps = “diploma empat”
ElseIf ps = “03″ Then
ps = “diploma tiga”
ElseIf ps = “04″ Then
ps = “diploma dua”
End If
program.Text = ps
no.Text = Right(NPM.Text, 3)
End Sub
Private Sub Command2_Click()
nama.SetFocus
nama.Text = “”
NPM.Text = “”
jurusan.Text = “”
program.Text = “”
tahun.Text = “”
no.Text = “”
End Sub
Private Sub Command3_Click()
nama.SetFocus
nama.Text = “”
NPM.Text = “”
jurusan.Text = “”
program.Text = “”
tahun.Text = “”
no.Text = “”
End Sub
Private Sub Command4_Click()
End
End Sub
Private Sub nama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
NPM.SetFocus
End If
End Sub
tugas VB : No. 4
13 FebPrivate Sub chKB_Click()
If Chkb.Value = 1 Then
LbljDL.FontBold = True
Else
LbljDL.FontBold = False
End If
End Sub
Private Sub chKI_Click()
If ChkI.Value = 1 Then
LbljDL.FontItalic = True
Else
LbljDL.FontItalic = False
End If
End Sub
Private Sub chKS_Click()
If ChKS.Value = 1 Then
LbljDL.FontStrikethru = True
Else
LbljDL.FontStrikethru = False
End If
End Sub
Private Sub chku_Click()
If Chku.Value = 1 Then
LbljDL.FontUnderline = True
Else
LbljDL.FontUnderline = False
End If
End Sub
Private Sub exit_Click()
End
End Sub
Private Sub blue_Click()
LbljDL.ForeColor = vbBlue
End Sub
Private Sub green_Click()
LbljDL.ForeColor = vbGreen
End Sub
Private Sub red_Click()
LbljDL.ForeColor = vbRed
End Sub
Private Sub yellow_Click()
LbljDL.ForeColor = vbYellow
End Sub
tugas VB : No. 3
13 FebPrivate Sub Cbo_Click()
Dim gapok, pajak, tunjangan, total As Variant
Select Case CBO.Text
Case “1”
gapok = 900000
tunjangan = 700000
Case “2”
gapok = 65000000
tunjangan = 500000
Case “3”
gapok = 4500000
tunjangan = 500000
Case “4”
gapok = 3000000
tunjangan = 400000
Case Else
gapok = 0
tunjangan = 0
End Select
total = gapok + tunjangan
pajak = total * 0.1
Text3.Text = gapok
Text4.Text = tunjangan
Text5.Text = pajak
Text6.Text = total – pajak
End Sub
Private Sub LG_Click()
kosong
End Sub
Private Sub BTL_Click()
kosong
End Sub
Private Sub KLR_Click()
kosong
End Sub
Private Sub Form_Load()
CBO.AddItem “1”
CBO.AddItem “2”
CBO.AddItem “3”
CBO.AddItem “4”
End Sub
Public Sub kosong()
Text1.SetFocus
Text1.Text = “”
Text2.Text = “”
Text3.Text = “”
Text4.Text = “”
Text5.Text = “”
Text6.Text = “”
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
tugas VB : No. 2
13 FebPrivate Sub cbo_Click()
Dim nama, jurusan, NM As String
Select Case CBO.Text
Case “12201110”
nama = “AJI SAKA”
jurusan = “manajemen informatika”
Case “12201119”
nama = “YILIANTORO”
jurusan = “manajemen informatika”
Case “11202009”
nama = “YUPRIL”
jurusan = “sistem informasi”
End Select
TXTH.Text = nama
TXTI.Text = jurusan
TXTJ.SetFocus
End Sub
Private Sub cmdBTL_Click()
CBO.SetFocus
TXTH = “”
TXTI = “”
TXTJ = “”
TxtK = “”
TXTL = “”
TXTM = “”
TXTN = “”
TXTHRF = “”
End Sub
Private Sub cmdKLR_Click()
End
End Sub
Private Sub cmdProses_Click()
Dim na As Integer
Dim HRF As String
QUIS = Val(TXTJ.Text)
TUGAS = Val(TxtK.Text)
UTS = Val(TXTL.Text)
UAS = Val(TXTM.Text)
na = (QUIS + TUGAS + UTS + UAS) / 4
TXTN.Text = na
Select Case TXTN.Text
Case Is > 80
HRF = “A”
Case Is > 70
HRF = “B”
Case Is > 60
HRF = “C”
Case Is > 50
HRF = “D”
Case Is < 50
HRF = “E”
End Select
TXTHRF.Text = HRF
End Sub
Private Sub Form_Load()
CBO.AddItem “12101111”
CBO.AddItem “12201119”
CBO.AddItem “11202009”
End Sub
Private Sub txtH_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TXTH.SetFocus
End If
End Sub
Private Sub txtI_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TXTI.SetFocus
End If
End Sub
Private Sub txtJ_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TXTJ.SetFocus
End If
End Sub
tugas VB : No. 1
13 FebPrivate Sub CMDKELUAR_Click()
End
End Sub
Private Sub CMDPROSES_Click()
Dim a, b, c, d, f As String
Txtgajikotor.Text = Val(Txtgajipokok.Text) + Val(Txttunjangan.Text) – Val(Txtpotongan.Text)
txtpajak.Text = Val(Txtgajikotor.Text) * 0.1
Txtgajiyangditerima.Text = Val(Txtgajikotor.Text) – Val(txtpajak.Text)
End Sub
Private Sub CMDULANG_Click()
Txtgajipokok.SetFocus
Txtgajipokok.Text = “”
Txttunjangan.Text = “”
Txtpotongan.Text = “”
Txtgajikotor.Text = “”
txtpajak.Text = “”
Txtgajiyangditerima.Text = “”
End Sub
Tugas VB : Kalkulator Mini
30 JanPrivate Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Command1_Click()
Text3.Text = Val(Text1.Text) * Val(Text2.Text)
End Sub
Private 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.SetFocus
Text1 = “”
Text2 = “”
Text3 = “”
End Sub
Private Sub Command6_Click()
End
End Sub