0

Update VB (16 maret 2013)

Picture2

Private Sub CmdBatal_Click()
Nama.SetFocus
Nama.Text = “”
NPM.Text = “”
Jurusan.Text = “”
Prodi.Text = “”
TM.Text = “”
NU.Text = “”
BP.Text = “”
End Sub

Private Sub CmdKeluar_Click()
End
End Sub

Private Sub CmdLagi_Click()
Nama.SetFocus
Nama.Text = “”
NPM.Text = “”
Jurusan.Text = “”
Prodi.Text = “”
TM.Text = “”
NU.Text = “”
BP.Text = “”
End Sub

Private Sub Cmdproses_Click()
Dim a As String
TM.Text = “20” & Left(NPM.Text, 2)
a = Mid(NPM.Text, 3, 1)
If a = “1” Then
jr = “Sistem Informasi”
ps = “Strata Satu”
BP = “1950000”
ElseIf a = “2” Then
jr = “Manajemen Informasi”
ps = “Diploma Tiga”
BP = “1800000”
ElseIf a = “3” Then
jr = “Tekhnik Inform0si”
ps = “Diploma Dua”
BP = “1400000”
ElseIf a = “4” Then
jr = “Komputer Akuntansi”
ps = “Strata Satu”
BP = “1750000”
End If

Jurusan.Text = jr
Prodi.Text = ps
NU.Text = NU
BP.Text = BP
NU.Text = Right(NPM.Text, 3)
End Sub

Private Sub Nama_keypress(KeyAscii As Integer)
If KeyAscii = 13 Then
NPM.SetFocus
End If
End Sub

0

Tugas VB (Sinkron With MS. Acces)

cats

Private Sub Command5_Click()

Dim snpm As String

snpm = InputBox(“npm:*”)

Adodc1.Recordset.MoveFirst

Adodc1.Recordset.Find “npm = ” & snpm & “”

End Sub

 

Private Sub Command1_Click()

Text2.SetFocus

Adodc1.Recordset.AddNew

End Sub

 

Private Sub Command2_Click()

Adodc1.Recordset.Update

MsgBox “Succes”, vbOKOnly + vbInformation, “konfirmasi”

End Sub

 

Private Sub Command3_Click()

If MsgBox(“apakah anda yakin”, vbOKCancel + vbCritical, “konfirmasi”) = vbOK Then

Adodc1.Recordset.Delete

End If

End Sub

 

Private Sub Command4_Click()

End

End Sub

 

Private Sub Form_Activate()

Text2.SetFocus

Text2.Text = “”

Text1.Text = “”

Text3.Text = “”

Text4.Text = “”

Text5.Text = “”

Text6.Text = “”

End Sub

0

Tugas VB (Data Pegawai)

9

Private Sub cmdBTL_Click()

txtNK.SetFocus

txtGOL.Text = “”

txtKS.Text = “”

txtS.Text = “”

txtTH.Text = “”

txtJB.Text = “”

txtBG.Text = “”

txtGPOK.Text = “”

txtTNJ.Text = “”

txtTTAL.Text = “”

txtNK.Text = “”

txtNIK.Text = “”

End Sub

 

Private Sub cmdKL_Click()

End

End Sub

 

Private Sub cmdLG_Click()

txtNK.SetFocus

txtGOL.Text = “”

txtKS.Text = “”

txtS.Text = “”

txtTH.Text = “”

txtJB.Text = “”

txtBG.Text = “”

txtGPOK.Text = “”

txtTNJ.Text = “”

txtTTAL.Text = “”

txtNK.Text = “”

txtNIK.Text = “”

End Sub

 

Private Sub cmdPRS_Click()

Dim gl, ks, s As String

Dim th, jb, bg As Variant

Dim gp, tnj, ttal As Long

txtTH.Text = Left(txtNIK.Text, 4)

a = Mid(txtNIK.Text, 5, 1)

If a = “A” Then

gl = “A”

jb = “Manager”

gp = “4000000?

tnj = “1025000?

ElseIf a = “B” Then

gl = “B”

jb = “Ka.Seksi”

gp = “3500000?

tnj = “975000?

ElseIf a = “C” Then

gl = “C”

jb = “Staff”

gp = “3000000?

tnj = “950000?

End If

txtGOL.Text = gl

txtJB.Text = jb

txtGPOK.Text = gp

txtTNJ.Text = tnj

a = Right(txtNIK.Text, 3)

If a = “KEU” Then

bg = “Accounting”

ElseIf a = “ADM” Then

bg = “Administrasi”

ElseIf a = “SDM” Then

bg = “General Affair”

ElseIf a = “EDP” Then

bg = “IT Unit”

ElseIf a = “SDP” Then

bg = “Security”

End If

txtBG.Text = bg

a = Mid(txtNIK.Text, 7, 1)

If a = “S” Then

ks = “S”

s = “Single”

ElseIf a = “M” Then

ks = “M”

s = “Menikah”

ElseIf a = “J” Then

ks = “J”

s = “Janda”

ElseIf a = “D” Then

ks = “D”

s = “Duda”

End If

txtKS.Text = ks

txtS.Text = s

txtTTAL.Text = Val(txtGPOK.Text) + Val(txtTNJ.Text)

End Sub

 

Private Sub txtNK_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtNIK.SetFocus

End If

End Sub

0

Tugas VB 2

8

Private 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

 

0

Tugas VB

7

Private 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″ & Right(cbo.Text, 2)
a = Mid(cbo.Text, 3, 3)
If a = “sim” Then
jb = “sistem informasi management”
pg = “yati nur oktavia”
hg = “75900″
ElseIf a = “edp” Then
jb = “elektronic data processing”
pg = “imam tarmizi”
hg = “62000″
ElseIf a = “mnj” Then
jb = “manajemen”
pg = “valentina mariana adiwianti”
hg = “42000″
ElseIf a = “cdr” Then
jb = “coreldraw”
pg = “riyan suhandi”
hg = “53000″
ElseIf a = “rpl” Then
jb = “rekayasa perangkat lunak”
pg = “sinta umpu singa”
hg = “83000″
End If
txta.Text = jb
txtb.Text = pg
txte.Text = hg
a = Left(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 “a-sim-01″
cbo.AddItem “i-edp-02″
cbo.AddItem “s-mnj-03″
cbo.AddItem “e-cdr-04″
cbo.AddItem “m-rpl-05″
End Sub

0

Tugas VB Membuat Font

Vb

Private 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

0

Tugas VB Membuat Data Mahasiswa

3

Private 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

0

Tugas VB 1

1

Private Sub chkbold_Click()
If chkbold.Value = 1 Then
label1.FontBold = True
Else
label1.FontBold = False
End If
End Sub

Private Sub chkitalic_Click()
If chkitalic.Value = 1 Then
label1.FontItalic = True
Else
label1.FontItalic = False
End If
End Sub

Private Sub chkstrikeout_Click()
If chkstrikeout.Value = 1 Then
label1.FontStrikethru = True
Else
label1.FontStrikethru = False
End If
End Sub

Private Sub chkunderline_Click()
If chkunderline.Value = 1 Then
lbljudul.FontUnderline = True
Else
label1.FontUnderline = False
End If
End Sub

Private Sub cmdkeluar_Click()
End
End Sub

Private Sub optBiru_Click()
lbljudul.ForeColor = vbBlue
End Sub

Private Sub optHijau_Click()
label1.ForeColor = vbGreen
End Sub

Private Sub optMerah_Click()
label1.ForeColor = vbRed
End Sub

Private Sub optKuning_Click()
label1.ForeColor = vbYellow
End Sub

0

kalkulator mini

aang kalk

Private 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