TUGAS VB 5

12

Private Sub Command1_Click()
    Text2.Text = Text1.Text
End Sub

Private Sub Command2_Click()
    End
End Sub

Private Sub Option1_Click()
    Text2.ForeColor = vbBlue
End Sub

Private Sub Option2_Click()
    Text2.ForeColor = vbRed
End Sub

Private Sub Check1_Click()
    Text2.FontBold = Check1.Value
End Sub

Private Sub Check2_Click()
    Text2.FontItalic = Check2.Value
End Sub

13

Private Sub Cmdbatal_Click()
txtnama.SetFocus
txtnama.Text = “”
txtnpm.Text = “”
txtjur.Text = “”
txtps.Text = “”
txttm.Text = “”
txturut.Text = “”
End Sub

Private Sub Cmdkeluar_Click()
Unload Me
End Sub

Private Sub Cmdlagi_Click()
txtnama.SetFocus
txtnama.Text = “”
txtnpm.Text = “”
txtjur.Text = “”
txtps.Text = “”
txttm.Text = “”
txturut.Text = “”
End Sub
Private Sub Cmdproses_Click()
Dim S As String
txttm.Text = “20” & Left(txtnpm.Text, 2)
S = Mid(txtnpm.Text, 3, 1)
If S = “1” Then
txtjur.Text = “Sistem Informasi”
ElseIf S = “2” Then
txtjur.Text = “Manajemen Informatika”
ElseIf S = “3” Then
txtjur.Text = “Tehnik Informatika”
ElseIf S = “4” Then
txtjur.Text = “Manajemen & Komp. Akuntansi”
End If
S = Mid(txtnpm.Text, 4, 2)
If S = “01” Then
txtps.Text = “Strata Satu”
ElseIf S = “02” Then
txtps.Text = “Diploma Tiga”
ElseIf S = “03” Then
txtps.Text = “Diploma Empat”
ElseIf S = “04” Then
txtps.Text = “Diploma Dua”
End If
txturut.Text = Right(txtnpm.Text, 3)
End Sub
Private Sub Form_activate()
txtnama.SetFocus
txtnama.Text = “”
txtnpm.Text = “”
txtjur.Text = “”
txtps.Text = “”
txttm.Text = “”
txturut.Text = “”
End Sub

Private Sub Txtnama_Keypress(Keyascii As Integer)
If Keyascii = 13 Then
txtnpm.SetFocus
End If
End Sub

14 copy

Private Sub Cmdbatal_Click()
kosong
End Sub
Private Sub cmdlagi_Click()
kosong
End Sub
Private Sub Form_load()
Cbogolongan.AddItem “I”
Cbogolongan.AddItem “II”
Cbogolongan.AddItem “III”
Cbogolongan.AddItem “IV”
End Sub

Private Sub Cmdkeluar_Click()
Unload Me
End Sub
Private Sub cbogolongan_Click()
Dim gapok, pajak, tunjangan, total As Variant
Select Case Cbogolongan.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
Case Else
gapok = 0
tunjangan = 0
End Select
total = gapok + tunjangan
pajak = total * 0.1
Txtgapok.Text = gapok
TXTTUNJANGAN.Text = tunjangan
TXTPAJAK.Text = pajak
TXTTOTAL.Text = total – pajak
End Sub
Public Sub kosong()
TxtNIDN.SetFocus
TxtNIDN.Text = “”
TXTNAMA.Text = “”
Cbogolongan.Text = “”
Txtgapok.Text = “”
TXTTUNJANGAN.Text = “”
TXTPAJAK.Text = “”
TXTTOTAL.Text = “”
End Sub

Private Sub txtnind_keypress(keyascii As Integer)
If keyascii = 13 Then
TXTNAMA.SetFocus
End If
End Sub
16

Private Sub cbokode_Click()
txtjj.SetFocus
End Sub
Private Sub cmdproses_Click()
Dim penjualan, discount, kode, merk, bayar, a, b As String
Dim harga As Variant
kode = Mid(cbokode.Text, 7, 5)
If kode = “MC965” Then
merk = “Apple MacBook Air MC965”
harga = “12800000”
ElseIf kode = “MC966” Then
merk = “Apple MacBook Air MC966”
harga = “15800000”
ElseIf kode = “MC968” Then
merk = “Apple MacBook Air MC968”
harga = “9900000”
ElseIf kode = “MC969” Then
merk = “Apple MacBook Air MC969”
harga = “11900000”
ElseIf kode = “MC700” Then
merk = “Apple MacBook Air MC700”
harga = “10800000”
ElseIf kode = “MC721” Then
merk = “Apple MacBook Air MC721”
harga = “15900000”
ElseIf kode = “MC723 ” Then
merk = “Apple MacBook Air MC723”
harga = “19300000”
ElseIf kode = “MC724” Then
merk = “Apple MacBook Air MC724”
harga = “13700000”
ElseIf kode = “MC311” Then
merk = “Apple MacBook Air MC311”
harga = “24200000”
ElseIf kode = “MC313” Then
merk = “Apple MacBook Air MC313”
harga = “11900000”
ElseIf kode = “MC314” Then
merk = “Apple MacBook Air MC314”
harga = “14700000”
ElseIf kode = “MC318” Then
merk = “Apple MacBook Air MC318”
harga = “17600000”
ElseIf kode = “MC322” Then
merk = “Apple MacBook Air MC322”
harga = “21300000”
ElseIf kode = “MC965” Then
merk = “Apple MacBook Air MC965”
harga = “12800000”
ElseIf kode = “MC966” Then
merk = “Apple MacBook Air MC966”
harga = “15800000”
End If
txtmerk.Text = merk
txths.Text = harga
a = Val(txtjj.Text)
b = Val(txths.Text)
penjualan = a * b
txthp.Text = penjualan
Select Case txthp.Text
Case Is > 140000000
discount = 0.15 * penjualan
Case Is > 135000000
discount = 0.1 * penjualan
Case Is > 130000000
discount = 0.05 * penjualan
Case Is > 125000000
discount = 0.02 * penjualan
End Select
penjualan = Val(txthp.Text)
txtdis.Text = discount
txttb.Text = Val(txthp.Text) – Val(txtdis.Text)
End Sub
Private Sub cmdlagi_Click()
cbokode.SetFocus
cbokode.Text = “”
txtmerk.Text = “”
txths.Text = “”
txtjj.Text = “”
txtdis.Text = “”
txttb.Text = “”
txthp.Text = “”
End Sub
Private Sub cmdkeluar_Click()
End
End Sub
Private Sub Form_Load()
cbokode.AddItem “Apple MC965 MasBook Air”
cbokode.AddItem “Apple MC966 MasBook Air”
cbokode.AddItem “Apple MC968 MasBook Air”
cbokode.AddItem “Apple MC969 MasBook Air”
cbokode.AddItem “Apple MC700 MasBook Pro”
cbokode.AddItem “Apple MC721 MasBook Pro”
cbokode.AddItem “Apple MC723 MasBook Pro”
cbokode.AddItem “Apple MC724 MasBook Pro”
cbokode.AddItem “Apple MC311 MasBook Pro”
cbokode.AddItem “Apple MC313 MasBook Pro”
cbokode.AddItem “Apple MC314 MasBook Pro”
cbokode.AddItem “Apple MC318 MasBook Pro”
cbokode.AddItem “Apple MC322 MasBook Pro”
cbokode.AddItem “Apple MC965 MasBook Air”
cbokode.AddItem “Apple MC966 MasBook Air”
End Sub

17

Private Sub cmdbatal_Click()
txtnama.SetFocus
txtnama.Text = “”
txtnik.Text = “”
txtgol.Text = “”
txtkode.Text = “”
txtstatus.Text = “”
txttahun.Text = “”
txtjabatan.Text = “”
txtbagian.Text = “”
txtgapok.Text = “”
txttunjangan.Text = “”
txttotal.Text = “”
End Sub
Private Sub cmdkeluar_Click()
End
End Sub
Private Sub cmdlagi_Click()
txtnama.SetFocus
txtnama.Text = “”
txtnik.Text = “”
txtgol.Text = “”
txtkode.Text = “”
txtstatus.Text = “”
txttahun.Text = “”
txtjabatan.Text = “”
txtbagian.Text = “”
txtgapok.Text = “”
txttunjangan.Text = “”
txttotal.Text = “”
End Sub
Private Sub cmdproses_Click()
Select Case a = Mid(txtnik.Text, 5, 1)
Case a = “A”
txtgol = “A”
txtjabatan.Text = “MANAGER”
txtgapok.Text = “4000000”
txttunjangan.Text = “1025000”
Case a = “B”
txtgol.Text = “B”
txtjabatan.Text = “Ka.SEKSI”
txtgapok.Text = “3500000”
txttunjangan.Text = “975000”
Case a = “C”
txtgol.Text = “C”
txtjabatan.Text = “STAFF”
txtgapok.Text = “3000000”
txttunjangan.Text = “925000”
End Select
a = Right(txtnik.Text, 3)
If a = “KEU” Then
txtbagian.Text = “ACCOUNTING”
ElseIf a = “ADM” Then
txtbagian.Text = “ADMINISTRASI”
ElseIf a = “SDM” Then
txtbagian.Text = “GENERAL AFFAIR”
ElseIf a = “EDP” Then
txtbagian.Text = “IT UNIT”
ElseIf a = “SPM” Then
txtbagian.Text = “SECURITY”
End If
Select Case a = Mid(txtnik.Text, 7, 1)
Case a = “S”
kode = “S”
Status = “SINGEL”
Case a = “M”
kode = “M”
Status = “MENIKAH”
Case a = “J”
kode = “J”
Status = “JANDA”
Case a = “D”
kode = “D”
Status = “DUDA”
End Select
txtkode.Text = kode
txtstatus.Text = Status
txttahun.Text = Left(txtnik.Text, 4)
txttotal.Text = Val(txtgapok.Text) + Val(txttunjangan.Text)
End Sub
Private Sub Form_Activate()
txtnama.SetFocus
End Sub
Private Sub txtnama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtnik.SetFocus
End If
End Sub

TUGAS 4

Untitled-2

Private Sub Cmdkeluar_Click()
End
End Sub

Private Sub CMDlagi_Click()
Txtkt.SetFocus
Txtkt = “”
Txtht = “”
Txtjk = “”
Txtjb = “”
Txtjt = “”
Txttotalp = “”
End Sub

Private Sub Cmdproses_Click()
kodetiket = Left(Txtkt.Text, 3)
If kodetiket = “BIM” Then
jeniskereta = “BIMA”
hargatiket = “50000”
jamberangkat = “16.00”
ElseIf kodetiket = “EKO” Then
jeniskereta = “EKONOMI”
hargatiket = “35000”
jamberangkat = “19.00”
ElseIf kodetiket = “MUT” Then
jeniskereta = “MUTIARA”
hargatiket = “23000”
jamberangkat = “17.00”
ElseIf kodetiket = “SEN” Then
jeniskereta = “SENJA”
hargatiket = “15000”
jamberangkat = “20.00”
End If
Txtkt.Text = kodetiket
Txtht.Text = hargatiket
Txtjk.Text = jeniskereta
Txtjb.Text = jamberangkat
Txtjt.SetFocus
End Sub

Private Sub Form_Activate()
Txtht.SetFocus
End Sub
Private Sub Txtjt_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Txttotalp.Text = Val(Txtht.Text) * Val(Txtjt.Text)
End If
End Sub

 

TUGAS 3

tugas 1 sulis

Private Sub command1_Click()
Text3 = Val(Text1.Text) * (Text2.Text)
End Sub
Private Sub Command2_Click()
Text1.SetFocus
Text1 = “”
Text2 = “”
Text3 = “”
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

tgas 1

tugas 2

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()
Unload Me
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
      Text2.SetFocus
    End If
End Sub

tugas222

tugas 3 sulis

Private Sub Command1_Click()
Text2.Text = Val(Text1.Text) * 0.1
Text3.Text = Val(Text1.Text) – Val(Text2.Text)
End Sub

Private Sub Command2_Click()
Text1.SetFocus
Text1 = “”
Text2 = “”
Text3 = “”
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

333

444444

Private Sub Command1_Click()
    Text4.Text = Val(Text1.Text) + (Text2.Text) – Val(Text3.Text)
    Text5.Text = Val(Text4.Text) * 0.1
    Text6.Text = Val(Text4.Text) – Val(Text5.Text)
End Sub

Private Sub Command2_Click()
Text1.SetFocus
    Text1 = “”
    Text2 = “”
    Text3 = “”
    Text4 = “”
    Text5 = “”
    Text6 = “”

End Sub

Private Sub Command3_Click()
Unload Me
End Sub

Private Sub Text1_Change()
If keyascii = 13 Then
    Text2.SetFocus
End If
End Sub

434

EEET

Private Sub Cbonpm_Click()
    Dim NAMA, JURUSAN, HM As String
    
    Select Case CBONPM.Text
        Case “12201009”
        NAMA = “DESI ISTIQOMAH”
        JURUSAN = “MANAJEMEN INFORMATIKA”
        
        Case “12100089”
        NAMA = ” SULIS WAHYUNINGSIH”
        JURUSAN = “SISTEM INFORMASI”
        
        Case “12100074”
        NAMA = “SITI MARYAM”
        JURUSAN = “SISTEM INFORMASI”
        
        Case “12100073”
        NAMA = “SITI MAIYSAROH”
        JURUSAN = “SISTEM INFORMASI”
        
    End Select
    TXTNAMA.Text = NAMA
    TXTJURUSAN.Text = JURUSAN
    TXTNQ.SetFocus
        
End Sub

Private Sub Cmdbatal_Click()
    CBONPM.SetFocus
    CBONPM.Text = “”
    TXTNAMA.Text = “”
    TXTJURUSAN.Text = “”
    TXTNQ.Text = “”
    TXTNT.Text = “”
    TXTNUTS.Text = “”
    TXTNUAS.Text = “”
    TXTNAK.Text = “”
    TXTHM.Text = “”
End Sub

Private Sub CMDKELUAR_Click()
    End
End Sub

Private Sub CMDPROSES_Click()
    Dim NAK As Integer
    Dim HM As String
    NQ = Val(TXTNQ.Text)
    NT = Val(TXTNT.Text)
    NUTS = Val(TXTNUTS.Text)
    NUAS = Val(TXTNUAS.Text)
    NAK = (NQ + NT + NUTS + NUAS) / 4
    TXTNAK.Text = NAK
    
    Select Case TXTNAK.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
        TXTHM.Text = HM
 End Sub

Private Sub Form_Load()
    CBONPM.AddItem “12201009”
    CBONPM.AddItem “12100089”
    CBONPM.AddItem “12100073”
    CBONPM.AddItem “12100074”
End Sub

Private Sub TXTJURUSAN_Change()

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
    TXTNUTS.SetFocus
    End If
End Sub

Private Sub TXTNUTS_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
    TXTNUAS.SetFocus
    End If
End Sub

TDDD

66

Private Sub ChkBOLD_Click()
    ‘Membuat Teks Tebal
    If ChkBOLD.Value = 1 Then
        lblTeks.FontBold = True
        Else
        lblTeks.FontBold = False
    End If
End Sub

Private Sub ChkITALIC_Click()
    ‘Membuat Teks Miring
    If ChkITALIC.Value = 1 Then
        lblTeks.FontItalic = True
        Else
        lblTeks.FontItalic = False
    End If
End Sub

Private Sub ChkSTRIKEOUT_Click()
    ‘Membuat Teks Strikeout
    If ChkSTRIKEOUT.Value = 1 Then
        lblTeks.FontStrikethru = True
        Else
        lblTeks.FontStrikethru = False
    End If
End Sub

Private Sub ChkUNDERLINE_Click()
    ‘Membuat Teks Underline
    If ChkUNDERLINE.Value = 1 Then
        lblTeks.FontUnderline = True
        Else
        lblTeks.FontUnderline = False
    End If
End Sub

Private Sub CMDEXIT_Click()
    End
End Sub

Private Sub OptBLUE_Click()
    ‘Membuat Teks Berwarna Biru
    lblTeks.ForeColor = vbBlue
End Sub

Private Sub OptGREEN_Click()
    ‘Membuat Teks Berwarna Hijau
    lblTeks.ForeColor = vbGreen
End Sub

Private Sub OptRED_Click()
    ‘Membuat Teks Berwarna Merah
    lblTeks.ForeColor = vbRed
End Sub

Private Sub OptYELLOW_Click()
    ‘Membuat Teks Berwarna Kuning
    lblTeks.ForeColor = vbYellow
End Sub

SSSS

TUGAS 2 VB

program

1. Kode Buah :

Private Sub txtkb_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtnb.SetFocus

End If

End Sub

2. Nama Buah :

Private Sub txtnb_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txthb.SetFocus

End If

End Sub

3. Harga Buah :

Private Sub txthb_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtjb.SetFocus

End If

End Sub

4. Jumlah Beli :

Private Sub txtjb_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txttb.Text = Val(txthb.Text) * (txtjb.Text)

End If

End Sub

5. Total Bayar :

Private Sub txttb_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

End If

End Sub

 

6. Lagi :

Private Sub cmdlagi_Click()

txtkb.SetFocus

txtkb = “”

txtnb = “”

txthb = “”

txtjb = “”

txttb = “”

End Sub

 

7. Batal :

Private Sub cmdbatal_Click()

txtkb.SetFocus

txtkb = “”

txtnb = “”

txthb = “”

txtjb = “”

txttb = “”

End Sub

8. Keluar :

Private Sub cmdkeluar_Click()

End

End Sub

TUGAS VB 2

program

1. Kode Buah :

Private Sub txtkb_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtnb.SetFocus

End If

End Sub

2. Nama Buah :

Private Sub txtnb_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txthb.SetFocus

End If

End Sub

3. Harga Buah :

Private Sub txthb_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtjb.SetFocus

End If

End Sub

4. Jumlah Beli :

Private Sub txtjb_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txttb.Text = Val(txthb.Text) * (txtjb.Text)

End If

End Sub

5. Total Bayar :

Private Sub txttb_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

End If

End Sub

 

6. Lagi :

Private Sub cmdlagi_Click()

txtkb.SetFocus

txtkb = “”

txtnb = “”

txthb = “”

txtjb = “”

txttb = “”

End Sub

 

7. Batal :

Private Sub cmdbatal_Click()

txtkb.SetFocus

txtkb = “”

txtnb = “”

txthb = “”

txtjb = “”

txttb = “”

End Sub

8. Keluar :

Private Sub cmdkeluar_Click()

End

End Sub

TUGAS 1

Untitled

1. NPM :

Private Sub txtnpm_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtnama.SetFocus
End If
End Sub

2. Nama Mahasiswa:                                                    
Private Sub txtnama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtps.SetFocus
End If
End Sub

3. Program Studi :
Private Sub txtps_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtjurusan.SetFocus
End If
End Sub

4. Jurusan :
Private Sub txtjurusan_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtsemester.SetFocus
End If
End Sub

5. Semester :
Private Sub txtsemester_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
End If
End Sub

6. Lagi :
Private Sub cmdlagi_Click()
txtnpm.SetFocus
txtnpm = “”
txtnama = “”
txtps = “”
txtjurusan = “”
txtsemester = “”
End Sub

7. Batal :                                   
Private Sub cmdbatal_Click()
txtnpm.SetFocus
txtnpm = “”
txtnama = “”
txtps = “”
txtjurusan = “”
txtsemester = “”
End Sub

8. Keluar :
Private Sub cmdkeluar_Click()
end
End Sub