Tugas VB #5#

dewi

Private Sub Txtnama_keypress(KeyAscii As Integer)

If KeyAscii = 13 Then

Txtnpm.SetFocus

End If

End Sub

 

Private Sub Cmdpros_Click()

Dim M As String

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

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

If J = “1” Then

Jur = “Sistem Informasi”

ElseIf J = “2” Then

Jur = “Manajemen Informatika”

ElseIf J = “3” Then

Jur = “Tehnik Informatika”

ElseIf J = “4” Then

Jur = “Manajemen & Komp.Akuntansi”

End If

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

If S = “01” Then

Prost = “Strata Satu”

ElseIf S = “02” Then

Prost = “Diploma Empat”

ElseIf S = “03” Then

Prost = “Diploma Tiga”

ElseIf S = “04” Then

Prost = “Diploma Dua”

End If

No = Right(Txtnpm.Text, 3)

Txtjur.Text = Jur

Txtprost.Text = Prost

Txtno.Text = No

End Sub

 

Private Sub Cmdsave_Click()

Data1.Recordset.Update

End Sub

 

Private Sub Cmdcancel_Click()

Data1.Recordset.Delete

End Sub

 

Private Sub Cmdexit_Click()

Unload Me

End Sub

 

Private Sub Cmdnew_Click()

Data1.Recordset.AddNew

Txtnpm.SetFocus

End Sub

Advertisements

Tugas VB Pertemuan 4

1.

Dew1

Private Sub Cmdproses_Click()

Dim X As String

Txtth.Text = “20” & Right(Txtkbu.Text, 2)

X = Left(Txtkbu.Text, 1)

If X = “A” Then

Pnr = “Andi Offset Yogyakarta”

ElseIf X = “I” Then

Pnr = “Indah Surabaya”

ElseIf X = “S” Then

Pnr = “Salemba Empat”

ElseIf X = “E” Then

Pnr = “Elek Media Komputindo”

ElseIf X = “M” Then

Pnr = “Maxicom”

End If

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

If P = “SIM” Then

Jdb = “Sisitem Informasi Manajemen”

Png = “Andra Setiawan”

Hrg = “75900”

ElseIf P = “EDP” Then

Jdb = “Elektronik Data Processing”

Png = “Desi Istiqomah”

Hrg = “62000”

ElseIf P = “MNJ” Then

Jdb = “Manajemen”

Png = “Sandy Fitrajaya”

Hrg = “42000”

ElseIf P = “CDR” Then

Jdb = “Corel draw”

Png = “Tri Indah Sari”

Hrg = “53000”

ElseIf P = “RPL” Then

Jdb = “Rekayasa Perangkat Lunak”

Png = “Ernita”

Hrg = “83000”

End If

Txtpnr.Text = Pnr

Txtjb.Text = Jdb

Txtpng.Text = Png

Txthrg.Text = Hrg

End Sub.

 

Private Sub Cmdlgi_Click()

Txtkbu.SetFocus

Txtkbu.Text = “”

Txtjb.Text = “”

Txtpng.Text = “”

Txtth.Text = “”

Txtpnr.Text = “”

Txthrg.Text = “”

End Sub

 

Private Sub Cmdbtl_Click()

Txtkbu.SetFocus

Txtkbu.Text = “”

Txtjb.Text = “”

Txtpng.Text = “”

Txtth.Text = “”

Txtpnr.Text = “”

Txthrg.Text = “”

End Sub

 

Private Sub Cmdkelwr_Click()

End

End Sub

2.

Dew2

Private Sub Cmdproses_Click()

Dim X As String

Txtth.Text = “20” & Mid(Txtkbu.Text, 5, 2)

X = Right(Txtkbu.Text, 1)

If X = “A” Then

Pnr = “Andi Offset Yogyakarta”

ElseIf X = “I” Then

Pnr = “Indah Surabaya”

ElseIf X = “S” Then

Pnr = “Salemba Empat”

ElseIf X = “E” Then

Pnr = “Elek Media Komputindo”

ElseIf X = “M” Then

Pnr = “Maxicom”

End If

P = Left(Txtkbu.Text, 3)

If P = “SIM” Then

Jdb = “Sisitem Informasi Manajemen”

Png = “Fadiya Ulfa”

Hrg = “75900”

ElseIf P = “EDP” Then

Jdb = “Elektronik Data Processing”

Png = “Nurul Agustina”

Hrg = “62000”

ElseIf P = “MNJ” Then

Jdb = “Manajemen”

Png = “Rian Hidayat”

Hrg = “42000”

ElseIf P = “CDR” Then

Jdb = “Corel draw”

Png = “Siti Nur Khotimah”

Hrg = “53000”

ElseIf P = “RPL” Then

Jdb = “Rekayasa Perangkat Lunak”

Png = “Winda Erlianti”

Hrg = “83000”

End If

Txtpnr.Text = Pnr

Txtjb.Text = Jdb

Txtpng.Text = Png

Txthrg.Text = Hrg

End Sub

 

Private Sub Cmdlg_Click()

Txtkbu.SetFocus

Txtkbu.Text = “”

Txtjb.Text = “”

Txtpng.Text = “”

Txtth.Text = “”

Txtpnr.Text = “”

Txthrg.Text = “”

End Sub

 

Private Sub Cmdbtl_Click()

Txtkbu.SetFocus

Txtkbu.Text = “”

Txtjb.Text = “”

Txtpng.Text = “”

Txtth.Text = “”

Txtpnr.Text = “”

Txthrg.Text = “”

End Sub

 

Private Sub Cmdkelwr_Click()

End

End Sub

3.

Dew3

Private Sub Txtnm_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Txtnik.SetFocus

End If

End Sub

 

Private Sub Cmdpros_Click()

Dim Jb, Bg, Gol, Ks, St As String

Dim Gjp, Tnj, Tgj As Currency

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

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

If GL = “A” Then

Gol = “A”

Jb = “Manajer”

Gjp = “4000000”

Tnj = “1025000”

ElseIf GL = “B” Then

Gol = “B”

Jb = “Ka.seksi”

Gjp = “3500000”

Tnj = “975000”

ElseIf GL = “C” Then

Gol = “C”

Jb = “Staff”

Gjp = “3000000”

Tnj = “925000”

End If

 

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

If S = “S” Then

Ks = “S”

St = “Single”

ElseIf S = “M” Then

Ks = “M”

St = “Menikah”

ElseIf S = “J” Then

Ks = “J”

St = “Janda”

ElseIf S = “D” Then

Ks = “D”

St = “Duda”

End If

 

B = Right(Txtnik.Text, 3)

If B = “KEU” Then

Bg = “Accounting”

ElseIf B = “ADM” Then

Bg = “Administrasi”

ElseIf B = “SDM” Then

Bg = “General Affair”

ElseIf B = “EDP” Then

Bg = “IT Unit”

ElseIf B = “SPM” Then

Bg = “Security”

End If

Tgj = Val(Gjp) + Val(Tnj)

Txtgpk.Text = Gjp

Txtjbt.Text = Jb

Txttnj.Text = Tnj

Txtstat.Text = St

Txtbag.Text = Bg

Txtgol.Text = Gol

Txtkst.Text = Ks

Txttgj.Text = Tgj

End Sub

 

Private Sub Cmdlgi_Click()

Txtnm.SetFocus

Txtnm = “”

Txtgol = “”

Txtkst = “”

Txtstat = “”

Txtthn = “”

Txtjbt = “”

Txtbag = “”

Txtgpk = “”

Txttnj = “”

Txttgj = “”

Txtnik = “”

End Sub

 

Private Sub Cmdbtl_Click()

Txtnm.SetFocus

Txtnm = “”

Txtgol = “”

Txtkod = “”

Txtstat = “”

Txtthn = “”

Txtjbt = “”

Txtbag = “”

Txtgpk = “”

Txttun = “”

Txttgj = “”

Txtnik = “”

End Sub

 

Private Sub Cmdklwr_Click()

End

End Sub

4.

Dew4

Private Sub Cmdproses_Click()

Dim X As String

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

X = Left(Txtkbu.Text, 1)

If X = “A” Then

Pnr = “Andi Offset Yogyakarta”

ElseIf X = “I” Then

Pnr = “Indah Surabaya”

ElseIf X = “S” Then

Pnr = “Salemba Empat”

ElseIf X = “E” Then

Pnr = “Elek Media Komputindo”

ElseIf X = “M” Then

Pnr = “Maxicom”

End If

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

If P = “SIM” Then

Jdb = “Sisitem Informasi Manajemen”

Png = “Yati Nur Oktavia”

Hrg = “75900”

ElseIf P = “EDP” Then

Jdb = “Elektronik Data Processing”

Png = “Imam Tarmizi”

Hrg = “62000”

ElseIf P = “MNJ” Then

Jdb = “Manajemen”

Png = “Valentina Mariana Adiwianti”

Hrg = “42000”

ElseIf P = “CDR” Then

Jdb = “Corel draw”

Png = “Riyan Suhadi”

Hrg = “53000”

ElseIf P = “RPL” Then

Jdb = “Rekayasa Perangkat Lunak”

Png = “Sinta Umpu Singa”

Hrg = “83000”

End If

Txtpnr.Text = Pnr

Txtjbk.Text = Jdb

Txtpng.Text = Png

Txthrg.Text = Hrg

End Sub

 

Private Sub Cmdlgi_Click()

Txtkbu.SetFocus

Txtkbu.Text = “”

Txtjbk.Text = “”

Txtpng.Text = “”

Txtthn.Text = “”

Txtpnr.Text = “”

Txthrg.Text = “”

End Sub

Private Sub Cmdbtl_Click()

Txtkbu.SetFocus

Txtkbu.Text = “”

Txtjbk.Text = “”

Txtpng.Text = “”

Txtthn.Text = “”

Txtpnr.Text = “”

Txthrg.Text = “”

End Sub

 

Private Sub Cmdkel_Click()

End

End Sub

Tugas VB Pertemuan #

1.

Dewi1

Private Sub Cbonpm_DblClick()

Private Sub form_load()

Cbonpm.AddItem “12201074”

Cbonpm.AddItem “12100101”

Cbonpm.AddItem “12100517”

Cbonpm.AddItem “12201109”

Cbonpm.AddItem “12201275”

End Sub

 

Private Sub Cbonpm_Click()

Dim nama, jurusan, AsString

 

Select Case Cbonpm.Text

Case “12201074”

nama = “Dewi Hartini”

jurusan = “Manajemen Informatika”

Case “12100101”

nama = “Rindi Antika”

jurusan = “Sistem Informasi”

Case “12100517”

nama = “Eko Mualip”

jurusan = “Sisitem Informasi”

Case “12201109”

nama = “Yustika”

jurusan = “Manajemen Informatika”

Case “12201275”

nama = “Rudiyansah”

jurusan = “Manajemen Informatika”

End Select

Txtnm.Text = nama

Txtjur.Text = jurusan

Txtnqu.SetFocus

End Sub

 

 

Private Sub Txtnqu_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Txtntgs.SetFocus

End If

End Sub

 

Private Sub Txtntgs_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 Cmdproses_Click()

Dim NilaiAkhir As Integer

Dim HurufMutu As String

quiz = Val(Txtnqu.Text)

tugas = Val(Txtntgs.Text)

uts = Val(Txtuts.Text)

uas = Val(Txtuas.Text)

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

Txtnla.Text = NilaiAkhir

 

Select Case Txtnla.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

Txthrfm.Text = HurufMutu

End Sub

 

Private Sub Cmdbtl_Click()

Cbonpm.SetFocus

Cbonpm = “”

Txtnm = “”

Txtjur = “”

Txtnqu = “”

Txtntgs = “”

Txtuts = “”

Txtuas = “”

Txtnla = “”

Txthrfm = “”

End Sub

 

Private Sub Cmdkel_Click()

End

End Sub

2.

dewi2

Private Sub Optmrh_Click()

Lblnama.ForeColor = vbRed

End Sub

 

Private Sub Opthij_Click()

Lblnama.ForeColor = vbGreen

End Sub

 

Private Sub Chkmrng_Click()

Lblnama.FontItalic = Chkmrng.Value

End Sub

 

Private Sub Chktbl_Click()

Lblnama.FontBold = Chktbl.Value

End Sub

 

Private Sub Cmdok_Click()

Lblnama.Caption = Txtnama.Text

End Sub

 

Private Sub Cmdklr_Click()

End

End Sub

3.

dewi3

Private Sub Txtnidn_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Txtnp.SetFocus

End If

End Sub

 

Private Sub Cbogol_DblClick()

Private Sub form_load()

Cbogol.AddItem “I”

Cbogol.AddItem “II”

Cbogol.AddItem “III”

Cbogol.AddItem “IV”

End Sub

 

Private Sub Cbogol_Click()

Dim Gajipokok, Pajak, Tunjangan, Total As Variant

Select Case Cbogol.Text

Case “I”

Gajipokok = 1500000

Tunjangan = 400000

Case “II”

Gajipokok = 2500000

Tunjangan = 700000

 

Case “III”

Gajipokok = 3500000

Tunjangan = 1000000

Case “IV”

Gajipokok = 4500000

Tunjangan = 1300000

Case Else

Gajipokok = 0

Tunjangan = 0

End Select

Total = Gajipokok + Tunjangan

Pajak = Total * 0.1

Txtgp.Text = Gajipokok

Txttun.Text = Tunjangan

Txtpjk.Text = Pajak

Txtttl.Text = Total – Pajak

 

 

Private Sub Cmdlgi_Click()

Txtnidn = “”

Txtnp = “”

Cbogol = “”

Txtgp = “”

Txttun = “”

Txtpjk = “”

Txtttl = “”

End Sub

 

Private Sub Cmdbtl_Click()

Txtnidn = “”

Txtnp = “”

Cbogol = “”

Txtgp = “”

Txttun= “”

Txtpjk = “”

Txtttl = “”

End Sub

 

Private Sub Cmdklr_Click()

End

End Sub

4.

dewi4

Private Sub Txtnm_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Txtnpm.SetFocus

End If

End Sub

 

 

Private Sub Cmdpros_Click()

Dim S As String

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

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

If S = “1” Then

Txtjur.Text = “Sisitem Informasi”

ElseIf S = “2” Then

Txtjur.Text = “Manajemen Informatika”

ElseIf S = “3” Then

Txtjur.Text = “Komputer Akuntansi Manajemen”

ElseIf S = “4” Then

Txtjur.Text = “Tehnik Informatika”

End If

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

If S = “00” Then

Txtprs.Text = “Strata Satu”

ElseIf S = “01” Then

Txtprs.Text = “Diploma Tiga”

ElseIf S = “02” Then

Txtprs.Text = “Diploma Dua”

ElseIf S = “03” Then

Txtprs.Text = “Diploma Satu”

End If

S = Right(Txtnpm.Text, 3)

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

End Sub

 

Private Sub Cmdlg_Click()

Txtnm.SetFocus

Txtnm = “”

Txtnpm = “”

Txtjur = “”

Txtprs = “”

Txtth = “”

Txtno = “”

End Sub

 

Private Sub Cmdbtl_Click()

Txtnama.SetFocus

Txtnm = “”

Txtnpm = “”

Txtjur = “”

Txtprs = “”

Txtth = “”

Txtno = “”

End Sub

 

Private Sub Cmdklr_Click()

End

End Sub

Tugas Visula Basic

1.

dew1

Private Sub txtaka1_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtaka2.SetFocus

End If

End Sub

 

Private Sub txtaka2_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Txtaka3.SetFocus

End If

End Sub

 

Private Sub Txtaka3_KeyPress(KeyAscii As Integer)

Txtaka3.Text = Val(txtaka1.Text) * Val(txtaka2.Text)

End Sub

 

Private Sub CmdProses_Click()

Txtaka3.Text = Val(txtaka1.Text) * Val(txtaka2.Text)

End Sub

 

Private Sub Cmddel_Click()

txtaka1 = “”

txtaka2 = “”

Txtaka3 = “”

End Sub

 

Private Sub Cmdklwr_Click()

End

End Sub

2.

dew5

Private Sub Txta1_Change()

If KeyAscii = 13 Then

Txta2.SetFocus

End If

End Sub

 

Private Sub Cmdbg_Click()

Txtttl.Text = Val(Txta1.Text) / Val(Txta2)

End Sub

 

Private Sub Cmdkl_Click()

Txtttl.Text = Val(Txta1.Text) * Val(Txta2)

End Sub

 

 

Private Sub Cmdples_Click()

Txtttl.Text = Val(Txta1.Text) + Val(Txta2.Text)

End Sub

 

Private Sub Cmdmin_Click()

Txtttl.Text = Val(Txta1.Text) – Val(Txta2.Text)

End Sub

 

Private Sub Cmdlagi_Click()

Txta1 = “”

Txta2 = “”

Txtttl = “”

End Sub

 

Private Sub Cmdklwr_Click()

End

End Sub

3.

dew4

Private Sub Cmdprs_Click()

Txtdisk.Text = Val(Txthg1.Text) * 0.1

Txthg2.Text = Val(Txthg1.Text) – Val(Txtdisk.Text)

End Sub

 

Private Sub Cmdlgi_Click()

Txthg1 = “”

Txtdisk = “”

Txthg2 = “”

End Sub

 

Private Sub Cmdklr_Click()

End

End Sub

4.

dew2

Private Sub optgrn_Click()

Lbltem.ForeColor = vbGreen

End Sub

 

Private Sub optblue_Click()

Lbltem.ForeColor = vbBlue

End Sub

 

Private Sub optred_Click()

Lbltem.ForeColor = vbRed

End Sub

 

Private Sub Optyelo_Click()

Lbltem.ForeColor = vbYellow

End Sub

 

 

Private Sub Chkita_Click()

If Chkita.Value = 1 Then

Lbltem.FontItalic = True

Else

Lbltem.FontItalic = False

End If

End Sub

 

Private Sub Chkbld_Click()

If Chkbld.Value = 1 Then

Lbltem.FontBold = True

Else

Lbltem.FontBold = False

End If

End Sub

 

Private Sub Chkunder_Click()

If Chkunder.Value = 1 Then

Lbltem.FontUnderline = True

Else

Lbltem.FontUnderline = False

End If

End Sub

 

Private Sub Chkstrik_Click()

If Chkstrik.Value = 1 Then

Lbltem.FontStrikethru = True

Else

Lbltem.FontStrikethru = False

End If

End Sub

 

Private Sub Cmdklwr_Click()

End

End Sub

5.

dew3

Private Sub Txtgjp_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Txttnj.SetFocus

End If

End Sub

 

Private Sub Txttnj_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Txtpot.SetFocus

End If

End Sub

 

 

Private Sub Cmdhtg_Click()

Txtgjk.Text = Val(Txtgjp.Text) + Val(Txttnj.Text) – Val(Txtpot.Text)

Txtpjk.Text = Val(Txtgjk.Text) * 0.1

Txtgjb.Text = Val(Txtgjk.Text) – Val(Txtpjk.Text)

End Sub

 

Private Sub Cmdlg_Click()

Txtgjp = “”

Txttnj = “”

Txtpot = “”

Txtgjk = “”

Txtpjk = “”

Txtgjb= “”

End Sub

 

Private Sub Cmdklwr_Click()

End

End Sub