Tugas VB %

lurah

Private Sub Cmdcancel_Click()

Data1.Recordset.Delete

Txtnama.SetFocus

End Sub

 

Private Sub Cmdexit_Click()

Unload Me

End Sub

 

Private Sub Cmdnew_Click()

Data1.Recordset.AddNew

End Sub

 

Private Sub Cmdproses_Click()

Dim jurusan, study As String

Dim th, no As Currency

th = “20” & Left(Txtnpm.Text, 2)

Txtth.Text = th

jurusan = Mid(Txtnpm.Text, 3, 1)

If jurusan = “1” Then

jurusan = “Sistem Informasi”

ElseIf jurusan = “2” Then

jurusan = “Manajemen Informatika”

ElseIf jurusan = “3” Then

jurusan = “Teknik Informatika”

ElseIf jurusan = “4” Then

jurusan = “Manajemen & Komp.Akutansi”

End If

Txtjurusan.Text = jurusan

study = Mid(Txtnpm.Text, 4, 2)

If study = “01” Then

study = “Strata Satu”

ElseIf study = “02” Then

study = “Diploma Empat”

ElseIf study = “03” Then

study = “Diploma Tiga”

ElseIf study = “04” Then

study = “Diploma Dua”

End If

Txtstudi.Text = study

no = Right(Txtnpm, 3)

Txtno.Text = no

End Sub

 

Private Sub Cmdsave_Click()

Data1.Recordset.Update

End Sub

 

Private Sub Txtnama_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Txtnpm.SetFocus

End If

End Sub

Advertisements

Tugas Visual Basic 4

1.

LUR1

Private Sub Cmdpros_Click()

Dim P As String

Txtthn.Text = “20” & Right(Txtkobu.Text, 2)

P = Left(Txtkobu.Text, 1)

If P = “A” Then

Pnr = “Andi Offset Yogyakarta”

ElseIf P = “I” Then

Pnr = “Indah Surabaya”

ElseIf P = “S” Then

Pnr = “Salemba Empat”

ElseIf P = “E” Then

Pnr = “Elek Media Komputindo”

ElseIf P = “M” Then

Pnr = “Maxicom”

End If

P = Mid(Txtkobu.Text, 3, 3)

If P = “SIM” Then

Jdb = “Sisitem Informasi Manajemen”

Peng = “Andra Setiawan”

Hrg = “75900”

ElseIf P = “EDP” Then

Jdb = “Elektronik Data Processing”

Peng = “Desi Istiqomah”

Hrg = “62000”

ElseIf P = “MNJ” Then

Jdb = “Manajemen”

Peng = “Sandy Fitrajaya”

Hrg = “42000”

ElseIf P = “CDR” Then

Jdb = “Corel draw”

Peng = “Tri Indah Sari”

Hrg = “53000”

ElseIf P = “RPL” Then

Jdb = “Rekayasa Perangkat Lunak”

Peng = “Ernita”

Hrg = “83000”

End If

Txtpnr.Text = Pnr

Txtjdb.Text = Jdb

Txtpeng.Text = Peng

Txthrg.Text = Hrg

End Sub.

 

Private Sub Cmdlagi_Click()

Txtkobu.SetFocus

Txtkobu.Text = “”

Txtjdb.Text = “”

Txtpeng.Text = “”

Txtthn.Text = “”

Txtpnr.Text = “”

Txthrg.Text = “”

End Sub

 

Private Sub Cmdbtl_Click()

Txtkobu.SetFocus

Txtkobu.Text = “”

Txtjdb.Text = “”

Txtpeng.Text = “”

Txtthn.Text = “”

Txtpnr.Text = “”

Txthrg.Text = “”

End Sub

 

Private Sub Cmdkel_Click()

End

End Sub

2.

LUR2

Private Sub Cmdpros_Click()

Dim S As String

Txtthn.Text = “20” & Mid(Txtkobu.Text, 5, 2)

S = Right(Txtkobu.Text, 1)

If S = “A” Then

Pnr = “Andi Offset Yogyakarta”

ElseIf S = “I” Then

Pnr = “Indah Surabaya”

ElseIf S = “S” Then

Pnr = “Salemba Empat”

ElseIf S = “E” Then

Pnr = “Elek Media Komputindo”

ElseIf S = “M” Then

Pnr = “Maxicom”

End If

S = Left(Txtkobu.Text, 3)

If S = “SIM” Then

Jdb = “Sisitem Informasi Manajemen”

Peng = “Fadiya Ulfa”

Hrg = “75900”

ElseIf S = “EDP” Then

Jdb = “Elektronik Data Processing”

Peng = “Nurul Agustina”

Hrg = “62000”

ElseIf S = “MNJ” Then

Jdb = “Manajemen”

Peng = “Rian Hidayat”

Hrg = “42000”

ElseIf S = “CDR” Then

Jdb = “Corel draw”

Peng = “Siti Nur Khotimah”

Hrg = “53000”

ElseIf S = “RPL” Then

Jdb = “Rekayasa Perangkat Lunak”

Peng = “Winda Erlianti”

Hrg = “83000”

End If

Txtpnr.Text = Pnr

Txtjdb.Text = Jdb

Txtpeng.Text = Peng

Txthrg.Text = Hrg

End Sub

 

Private Sub Cmdlagi_Click()

Txtkobu.SetFocus

Txtkobu.Text = “”

Txtjdb.Text = “”

Txtpeng.Text = “”

Txtthn.Text = “”

Txtpnr.Text = “”

Txthrg.Text = “”

End Sub

 

Private Sub Cmdbtl_Click()

Txtkobu.SetFocus

Txtkobu.Text = “”

Txtjdb.Text = “”

Txtpeng.Text = “”

Txtthn.Text = “”

Txtpnr.Text = “”

Txthrg.Text = “”

End Sub

 

Private Sub Cmdklr_Click()

End

End Sub

3.

LUR3

Private Sub Txtnm_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Txtnik.SetFocus

End If

End Sub

 

Private Sub Cmdproses_Click()

Dim Jbt, Bag, Gol, Ks, St As String

Dim Gjp, Tnj, Tgj As Currency

Txtthn.Text = Left(Txtnik.Text, 4)

G = Mid(Txtnik.Text, 5, 1)

If G = “A” Then

Gol = “A”

Jbt = “Manajer”

Gjp = “4000000”

Tnj = “1025000”

ElseIf G = “B” Then

Gol = “B”

Jbt = “Ka.seksi”

Gjp = “3500000”

Tnj = “975000”

ElseIf G = “C” Then

Gol = “C”

Jbt = “Staff”

Gjp = “3000000”

Tnj = “925000”

End If

 

G = Mid(Txtnik.Text, 7, 1)

If G = “S” Then

Ks = “S”

St = “Single”

ElseIf G = “M” Then

Ks = “M”

St = “Menikah”

ElseIf G = “J” Then

Ks = “J”

St = “Janda”

ElseIf G = “D” Then

Ks = “D”

St = “Duda”

End If

 

G = Right(Txtnik.Text, 3)

If G = “KEU” Then

Bag = “Accounting”

ElseIf G = “ADM” Then

Bag = “Administrasi”

ElseIf G = “SDM” Then

Bag = “General Affair”

ElseIf G = “EDP” Then

Bag = “IT Unit”

ElseIf G = “SPM” Then

Bag = “Security”

End If

Tgj = Val(Gjp) + Val(Tnj)

Txtgpk.Text = Gjp

Txtjab.Text = Jbt

Txttun.Text = Tnj

Txtst.Text = St

Txtbg.Text = Bag

Txtgol.Text = Gol

Txtks.Text = Ks

Txttgj.Text = Tgj

End Sub

 

Private Sub Cmdlagi_Click()

Txtnm.SetFocus

Txtnm = “”

Txtgol = “”

Txtks = “”

Txtst = “”

Txtthn = “”

Txtjab = “”

Txtbg = “”

Txtgpk = “”

Txttun = “”

Txttgj = “”

Txtnik = “”

End Sub

 

Private Sub Cmdbtl_Click()

Txtnm.SetFocus

Txtnm = “”

Txtgol = “”

Txtks = “”

Txtst = “”

Txtthn = “”

Txtjab = “”

Txtbg = “”

Txtgpk = “”

Txttun = “”

Txttgj = “”

Txtnik = “”

End Sub

 

Private Sub Cmdklw_Click()

End

End Sub

4.

LUR4

Private Sub Cmdpros_Click()

Dim P As String

Txtthn.Text = “20” & Right(Txtkobu.Text, 2)

P = Left(Txtkobu.Text, 1)

If P = “A” Then

Pnr = “Andi Offset Yogyakarta”

ElseIf P = “I” Then

Pnr = “Indah Surabaya”

ElseIf P = “S” Then

Pnr = “Salemba Empat”

ElseIf P = “E” Then

Pnr = “Elek Media Komputindo”

ElseIf P = “M” Then

Pnr = “Maxicom”

End If

P = Mid(Txtkobu.Text, 3, 3)

If P = “SIM” Then

Jdb = “Sisitem Informasi Manajemen”

Peng = “Yati Nur Oktavia”

Hrg = “75900”

ElseIf P = “EDP” Then

Jdb = “Elektronik Data Processing”

Peng = “Imam Tarmizi”

Hrg = “62000”

ElseIf P = “MNJ” Then

Jdb = “Manajemen”

Peng = “Valentina Mariana Adiwianti”

Hrg = “42000”

ElseIf P = “CDR” Then

Jdb = “Corel draw”

Peng = “Riyan Suhadi”

Hrg = “53000”

ElseIf P = “RPL” Then

Jdb = “Rekayasa Perangkat Lunak”

Peng = “Sinta Umpu Singa”

Hrg = “83000”

End If

Txtpnr.Text = Pnr

Txtjdbk.Text = Jdb

Txtpeng.Text = Peng

Txthrg.Text = Hrg

End Sub

 

Private Sub Cmdlgi_Click()

Txtkobu.SetFocus

Txtkobu.Text = “”

Txtjdbk.Text = “”

Txtpeng.Text = “”

Txtthn.Text = “”

Txtpnr.Text = “”

Txthrg.Text = “”

End Sub

Private Sub Cmdbtl_Click()

Txtkobu.SetFocus

Txtkobu.Text = “”

Txtjdbk.Text = “”

Txtpeng.Text = “”

Txtthn.Text = “”

Txtpnr.Text = “”

Txthrg.Text = “”

End Sub

 

Private Sub Cmdklr_Click()

End

End Sub

Tugas Visual Basic Pertemuan 3

1.

sn1

Private Sub Cbonpm_Click()

Dim nama, jurusan, AsString

Select Case Cbonpm.Text

Case “12100500”

nama = “Sunarsih”

jurusan = “Sistem Informasi”

Case “12101270”

nama = “Eko Mualip”

jurusan = “Manajemen Informatika”

Case “12100417”

nama = “Yustika”

jurusan = “Sistem Informasi”

Case “12101019”

nama = “Iqbal Zulkarnain”

jurusan = “Manajemen Informatika”

Case “12100219”

nama = “Rindi Antika”

jurusan = “Sisitem Informasi”

End Select

Txtnma.Text = nama

Txtjrs.Text = jurusan.

 

Private Sub Cbonpm_DblClick()

Private Sub form_load()

Cbonpm.AddItem “12100500”

Cbonpm.AddItem “12101270”

Cbonpm.AddItem “12100417”

Cbonpm.AddItem “12101019”

Cbonpm.AddItem “12100219”

End Sub

 

Private Sub Txtnq_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Txtnt.SetFocus

End If

End Sub

 

Private Sub Txtnt_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Txtuts.SetFocus

End If

End Sub

 

Private Sub Txtuts_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Txtuas.SetFocus

End If

End Sub

 

Private Sub Cmdpros_Click()

Dim NilaiAkhir As Integer

Dim HurufMutu As String

quiz = Val(Txtnq.Text)

tugas = Val(Txtnt.Text)

uts = Val(Txtuts.Text)

uas = Val(Txtuas.Text)

NilaiAkhir = (quiz + tugas + uts + uas) / 4

Txtnlk.Text = NilaiAkhir

 

Select Case Txtnlk.Text

Case Is > 80

HurufMutu = “A”

Case Is > 70

HurufMutu = “B”

Case Is > 60

HurufMutu = “C”

Case Is > 50

HurufMutu = “D”

Case Is <50

HurufMutu = “E”

End Select

Txthm.Text = HurufMutu

End Sub

 

Private Sub Cmdbtl_Click()

Cbonpm.SetFocus

Cbonpm = “”

Txtnma = “”

Txtjrs = “”

Txtnq = “”

Txtnt = “”

Txtuts = “”

Txtuas = “”

Txtnlk = “”

Txthm = “”

End Sub

 

Private Sub Cmdklr_Click()

End

End Sub

2.

sn2

Private Sub Optrmrh_Click()

Lblnama.ForeColor = vbRed

End Sub

 

Private Sub Opthij_Click()

Lblnama.ForeColor = vbGreen

End Sub

 

Private Sub Chktbl_Click()

Lblnama.FontBold = Chktbl.Value

End Sub

 

Private Sub Chkmrng_Click()

Lblnama.FontItalic = Chkmrng.Value

End Sub

Private Sub Cmdok_Click()

Lblnama.Caption = Txtnama.Text

End Sub

 

Private Sub Cmdklwr_Click()

End

End Sub

3.

sn3

Private Sub Txtnd_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Txtnmpg.SetFocus

End If

End Sub

 

Private Sub Cbogol_DblClick()

Private Sub form_load()

Cbogol.AddItem “I”

Cbogol.AddItem “II”

Cbogol.AddItem “III”

End Sub

 

Private Sub Cbogol_Click()

Dim Gajipokok, Pajak, Tunjangan, Gajibersih As Variant

Select Case Cbogol.Text

Case “I”

Gajipokok = 1500000

Tunjangan = 300000

Case “II”

Gajipokok = 2000000

Tunjangan = 600000

Case “III”

Gajipokok = 3000000

Tunjangan = 900000

Case Else

Gajipokok = 0

Tunjangan = 0

End Select

Gajibersih = Gajipokok + Tunjangan

Pajak = Gajibersih * 0.1

Txtgjpk.Text = Gajipokok

Txttnj.Text = Tunjangan

Txtpjk.Text = Pajak

Txtgjbr = Gajibersih – Pajak

 

 

Private Sub Cmdlgi_Click()

Txtnd = “”

Txtnmpg = “”

Cbogol = “”

Txtgjpk = “”

Txttnj = “”

Txtpjk = “”

Txtgjbr = “”

End Sub

 

Private Sub Cmdbtl_Click()

Txtnd = “”

Txtnmpg = “”

Cbogol = “”

Txtgjpk = “”

Txttnj = “”

Txtpjk = “”

Txtgjbr = “”

End Sub

 

Private Sub Cmdklwr_Click()

End

End Sub

4.

sn4

Private Sub Txtnama_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Txtnpm.SetFocus

End If

End Sub

 

Private Sub Cmdprs_Click()

Dim St As String

Txtthn.Text = “20” & Left(Txtnpm.Text, 2)

St = Mid(Txtnpm.Text, 3, 1)

If St = “1” Then

Txtjrs.Text = “Sistem Informasi”

ElseIf St = “2” Then

Txtjrs.Text = “Manajemen Informasi”

ElseIf St = “3” Then

Txtjrs.Text = “Komputer Akuntansi”

ElseIf St = “4” Then

Txtjrs.Text = “Tehnik Informatika”

End If

St = Mid(Txtnpm.Text, 4, 2)

If St = “00” Then

Txtpst.Text = “Strata Satu”

ElseIf St = “01” Then

Txtpst.Text = “Diploma Tig ”

ElseIf St = “02” Then

Txtpst.Text = “Diploma Dua”

ElseIf St = “03” Then

Txtpst.Text = “Diploma Empat”

End If

St = Right(Txtnpm.Text, 3)

Txtnur.Text = Right(Txtnpm.Text, 3)

End Sub

 

Private Sub Cmdlagi_Click()

Txtnama.SetFocus

Txtnama = “”

Txtnpm = “”

Txtjrs = “”

Txtpst = “”

Txtthn = “”

Txtnur = “”

End Sub

 

Private Sub Cmdbatal_Click()

Txtnama.SetFocus

Txtnama = “”

Txtnpm = “”

Txtjrs = “”

Txtpst = “”

Txtthn = “”

Txtnur = “”

End Sub

 

Private Sub Cmdout_Click()

End

End Sub

Tugas Visual Basic Pertemuan 2

1.

sun1

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

 

Private Sub Txtn3_KeyPress(KeyAscii As Integer)

Txtn3.Text = Val(txtn1.Text) * Val(txtn2.Text)

End Sub

 

Private Sub CmdPros_Click()

Txtn3.Text = Val(txtn1.Text) * Val(txtn2.Text)

End Sub

 

Private Sub Cmddel_Click()

txtn1 = “”

txtn2 = “”

Txtn3 = “”

End Sub

 

Private Sub Cmdklwr_Click()

End

End Sub

 

2.

sun5

Private Sub Txtbl1_Change()

If KeyAscii = 13 Then

Txtbl2.SetFocus

End If

End Sub

 

Private Sub Cmdbg_Click()

Txtjmlh.Text = Val(Txtbl1.Text) / Val(Txtbl2)

End Sub

 

Private Sub Cmdkl_Click()

Txtjmlh.Text = Val(Txtbl1.Text) * Val(Txtbl2)

End Sub

 

 

Private Sub Cmdkrgs_Click()

Txtjmlh.Text = Val(Txtbl1.Text) – Val(Txtbl2.Text)

End Sub

 

Private Sub Cmdtmb_Click()

Txtjmlh.Text = Val(Txtbl1.Text) + Val(Txtbl2.Text)

End Sub

 

Private Sub Cmdlagi_Click()

Txtbl1 = “”

Txtbl2 = “”

Txtjmlh = “”

End Sub

 

Private Sub Cmdklwr_Click()

End

End Sub

sun4

Private Sub Cmdpros_Click()

Txtdskn.Text = Val(Txtnil1.Text) * 0.2

Txtnil2.Text = Val(Txtnil1.Text) – Val(Txtdskn.Text)

End Sub

 

Private Sub Cmdlagi_Click()

Txtnil1 = “”

Txtdskn = “”

Txtnil2 = “”

End Sub

 

Private Sub Cmdklwr_Click()

End

End Sub

4.

sun2

Private Sub optbl_Click()

Lbljdl.ForeColor = vbBlue

End Sub

 

Private Sub optgr_Click()

Lbljdl.ForeColor = vbGreen

End Sub

 

Private Sub optrd_Click()

Lbljdl.ForeColor = vbRed

End Sub

 

Private Sub Optyl_Click()

Lbljdl.ForeColor = vbYellow

End Sub

 

 

Private Sub Chkun_Click()

If Chkun.Value = 1 Then

Lbljdl.FontUnderline = True

Else

Lbljdl.FontUnderline = False

End If

End Sub

 

Private Sub Chkit_Click()

If Chkit.Value = 1 Then

Lbljdl.FontItalic = True

Else

Lbljdl.FontItalic = False

End If

End Sub

 

Private Sub Chkbl_Click()

If Chkbl.Value = 1 Then

Lbljdl.FontBold = True

Else

Lbljdl.FontBold = False

End If

End Sub

 

Private Sub Chkst_Click()

If Chkst.Value = 1 Then

Lbljdl.FontStrikethru = True

Else

Lbljdl.FontStrikethru = False

End If

End Sub

 

Private Sub Cmdklwr_Click()

End

End Sub

5.

Sun3

Private Sub Txtgp_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Txttnjg.SetFocus

End If

End Sub

 

Private Sub Txttnjg_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Txtptg.SetFocus

End If

End Sub

 

 

Private Sub Cmdhsl_Click()

Txtgk.Text = Val(Txtgp.Text) + Val(Txttnjg.Text) – Val(Txtptg.Text)

Txtpj.Text = Val(Txtgk.Text) * 0.1

Txtgb.Text = Val(Txtgk.Text) – Val(Txtpj.Text)

End Sub

 

Private Sub Cmdlg_Click()

Txtgp = “”

Txttnjg = “”

Txtptg = “”

Txtgk = “”

Txtpj = “”

Txtgb= “”

End Sub

 

Private Sub Cmdklr_Click()

End

End Sub