Tugas VB (21 Februari 2013)

0

1

2

 

Iklan

TUGAS VB

0

PENJUALAN TIKET

Anwar

 

Private Sub cmdkeluar_Click()
Unload Me
End Sub

Private Sub cmdlagi_Click()
txtkt.SetFocus
txtkt.Text = “”
txtht.Text = “”
txtjk.Text = “”
txtjb.Text = “”
txtjt.Text = “”
txttotalp.Text = “”
End Sub

Private Sub cmdproses_Click()
Dim jk, jb As String
Dim ht As Currency
Select Case txtkt.Text
Case Is = “BIM”
a = 50000
b = “BIMA”
c = “16.00”
Case Is = “EKO”
a = “35000”
b = “EKONOMI”
c = “19.00”
Case Is = “MUT”
a = “23000”
b = “MUTIARA”
c = “17.00”
Case Is = “SEN”
a = “15000”
b = “SENJA”
c = “20.00”
End Select
txtht.Text = a
txtjk.Text = b
txtjb.Text = c
txtjt.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

0

Tugas 6

6

Private Sub CMDHitung_Click()
txt2 = Val(txt1.Text) * 0.1
txt3 = Val(txt1.Text) – Val(txt2.Text)
End Sub

Private Sub CMDQuit_Click()
Unload Me
End Sub

Private Sub CMDUlangi_Click()
txt1.SetFocus
txt1 = ” ”
txt2 = ” ”
txt3 = ” ”
End Sub

Private Sub txt1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txt2.SetFocus
End If
End Sub

 

 

Tugas 4

7
Private Sub cbonpm_Click()
Dim nama, jurusan, hm As String
Select Case cbonpm.Text
Case “12100082”
nama = “Anwar Azhary”
jurusan = “Sistem Informasi”
Case “12100083”
nama = ” MY Arya Hendrawan”
jurusan = “Sistem Informasi”
Case “12201008”
nama = “Andra Setiawan”
jurusan = “Manajemen Informatika”
End Select
txtnama.Text = nama
txtjur.Text = jurusan
txtquis.SetFocus
End Sub

Private Sub cmdbatal_Click()
cbonpm.SetFocus
cbonpm.Text = ” ”
txtnama.Text = ” ”
txtjur.Text = ” ”
txtquis.Text = ” ”
txttugas.Text = ” ”
txtuts.Text = ” ”
txtuas.Text = ” ”
txtna.Text = ” ”
txthm.Text = ” ”
End Sub

Private Sub cmdkeluar_Click()
Unload Me
End Sub

Private Sub cmdproses_Click()
Dim na As Integer
Dim hm As String
quis = Val(txtquis.Text)
tugas = Val(txttugas.Text)
uts = Val(txtuts.Text)
uas = Val(txtuas.Text)
na = (quis + tugas + uts + uas) / 4
txtna.Text = na
Select Case txtna.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 “12100082”
cbonpm.AddItem “12100083”
cbonpm.AddItem “12201008”
End Sub

Private Sub txtquis_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txttugas.SetFocus
End If
End Sub

Private Sub txttugas_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

TUGAS VB PERTEMUAN 2 (B)

0

TUGAS 5

5

Private Sub CMDA_Click()
txthasil = Val(txt1.Text) + Val(txt2.Text)
End Sub

Private Sub CMDB_Click()
txthasil = Val(txt1.Text) – Val(txt2.Text)
End Sub

Private Sub CMDC_Click()
txthasil = Val(txt1.Text) * Val(txt2.Text)
End Sub

Private Sub CMDD_Click()
txthasil = Val(txt1.Text) / Val(txt2.Text)
End Sub

Private Sub CMDFinish_Click()
Unload Me
End Sub

Private Sub CMDUlang_Click()
txt1.SetFocus
txt1 = ” ”
txt2 = ” ”
txthasil = ” ”
End Sub

Private Sub txt1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txt2.SetFocus
End If
End Sub

TUGAS VB PERTEMUAN 2

0

TUGAS 1

1

Private Sub CMDBersih_Click()

txtx.SetFocus

txtx = ” ”

txty = ” ”

txtz = ” ”

End Sub

 

Private Sub CMDHitung_Click()

txtz.Text = Val(txtx.Text) * Val(txty.Text)

End Sub

 

Private Sub CMDKeluar_Click()

Unload Me

End Sub

 

Private Sub txtx_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txty.SetFocus

End If

End Sub

 

TUGAS 2

2

Private Sub chkB_Click()

‘membuat teks tebal

If chkB.Value = 1 Then

lblvb.FontBold = True

Else

lblvb.FontBold = False

End If

End Sub

 

Private Sub chkI_Click()

‘membuat teks miring

If chkI.Value = 1 Then

lblvb.FontItalic = True

Else

lblvb.FontItalic = False

End If

End Sub

 

Private Sub chkS_Click()

‘membuat teks bergaris tengah

If chkS.Value = 1 Then

lblvb.FontStrikethru = True

Else

lblvb.FontStrikethru = False

End If

End Sub

 

Private Sub chkU_Click()

‘membuat teks bergaris bawah

If chkU.Value = 1 Then

lblvb.FontUnderline = True

Else

lblvb.FontUnderline = False

End If

End Sub

 

Private Sub CMDExit_Click()

Unload Me

End Sub

 

Private Sub optblue_Click()

‘membuat teks berwarna biru

lblvb.ForeColor = vbBlue

End Sub

 

Private Sub optgreen_Click()

‘membuat teks berwarna hijau

lblvb.ForeColor = vbGreen

End Sub

 

Private Sub optred_Click()

‘membuat teks berwarna merah

lblvb.ForeColor = vbRed

End Sub

 

Private Sub optyellow_Click()

‘membuat teks berwarna kuning

lblvb.ForeColor = vbYellow

End Sub

 

TUGAS 4

4

Private Sub CMDKeluar_Click()

Unload Me

End Sub

 

Private Sub CMDProses_Click()

txt4.Text = Val(txt1.Text) + Val(txt2.Text) – Val(txt3.Text)

txt5.Text = Val(txt4.Text) * 0.1

txt6.Text = Val(txt4.Text) – Val(txt5.Text)

End Sub

 

Private Sub CMDUlang_Click()

txt1.SetFocus

txt1 = ” ”

txt2 = ” ”

txt3 = ” ”

txt4 = ” ”

txt5 = ” ”

txt6 = ” ”

End Sub

Private Sub txt1_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txt2.SetFocus

End If

End Sub

Private Sub txt2_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txt3.SetFocus

End If

Tugas VB

0

Tugas 1

Anwar1

Private Sub CMDBatal_Click()

TXTNPM.SetFocus

TXTNPM = ” ”

TXTNM = ” ”

TXTPS = ” ”

TXTJUR = ” ”

TXTAL = ” ”

End Sub

 

Private Sub CMDKeluar_Click()

Unload Me

End Sub

 

Private Sub CMDLagi_Click()

TXTNPM.SetFocus

TXTNPM = ” ”

TXTNM = ” ”

TXTPS = ” ”

TXTJUR = ” ”

TXTAL = ” ”

End Sub

 

Private Sub TXTJUR_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

TXTAL.SetFocus

End If

End Sub

 

Private Sub TXTNM_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

TXTPS.SetFocus

End If

End Sub

Private Sub TXTNPM_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

TXTNM.SetFocus

End If

End Sub

Private Sub TXTPS_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

TXTJUR.SetFocus

End If

End Sub

 

 

 

TUGAS 2

 

Anwar2

Private Sub CMDBatal_Click()

TXTKB.SetFocus

TXTKB = ” ”

TXTNB = ” ”

TXTHB = ” ”

TXTJB = ” ”

TXTJBY = ” ”

End Sub

 

Private Sub CMDKeluar_Click()

Unload Me

End Sub

 

Private Sub CMDLagi_Click()

TXTKB.SetFocus

TXTKB = ” ”

TXTNB = ” ”

TXTHB = ” ”

TXTJB = ” ”

TXTJBY = ” ”

End Sub

 

Private Sub TXTJBY_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

TXTJBY.Text = Val(TXTHB.Text) * Val(TXTJB.Text)

End If

End Sub

 

Private Sub TXTHB_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

TXTJB.SetFocus

End If

End Sub

 

Private Sub TXTJB_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

TXTJBY.SetFocus

End If

End Sub

 

Private Sub TXTKB_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

TXTNB.SetFocus

End If

End Sub

 

Private Sub TXTNB_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

TXTHB.SetFocus

End If

End Sub