VISUAL BASIC

TUGAS VISUAL BASIC 6.0 KE-2
NAMA : ADE IRFAN SETIAWAN
NPM : 11100013
KELAS : YAHOO 1
JURUSAN : SISTEM INFORMASI

 

 

 

 

 

 

KODE PROGRAM:PERHITUNGAN GAJI

Private Sub Command1_Click()
Dim a, b, c, d, e, f As Integer
txtd.Text = Val(Txta.Text) + Val(Txtb.Text) – Val(txtc.Text)
txte.Text = Val(txtd.Text) * (0.1)
txtf.Text = Val(txtd.Text) – Val(txte.Text)
End Sub

Private Sub Command2_Click()
Txta.SetFocus
Txta.Text = “”
Txtb.Text = “”
txtc.Text = “”
txtd.Text = “”
txte.Text = “”
txtf.Text = “”
End Sub

Private Sub Command3_Click()
Unload Me
End Sub

KODE PROGRAM:HURUF MUTU
Private Sub Combo1_Click()
Dim nama, jurusan As String

Select Case Combo1.Text
Case “11100013”
nama = “ADE IRFAN SETIAWAN”
jurusan = “SISTEM INFORMASI”

Case “11100014”
nama = “SONI F”
jurusan = “SISTEM INFORMASI”

Case “11100156”
nama = ” ADITYA”
jurusan = “MANAJEMEN INFORMATIKA”

Case “10100157”
nama = “VANESSA”
jurusan = “MANAJEMEN INFORMATIKA”

End Select
Text1.Text = nama
Text2.Text = jurusan
Text3.SetFocus
End Sub

Private Sub Command1_Click()
Dim kuis, tugas, uts, uas, na As Integer
Dim hm As String
kuis = Val(Text3.Text)
tugas = Val(Text4.Text)
uts = Val(Text5.Text)
uas = Val(Text6.Text)
na = Val(kuis + tugas + uts + uas) / 4
Text7.Text = na

Select Case Text7.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
Text8.Text = hm
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Command3_Click()
Combo1.Text = “”
Text1.Text = “”
Text2.Text = “”
Text3.Text = “”
Text4.Text = “”
Text5.Text = “”
Text6.Text = “”
Text7.Text = “”
Text8.Text = “”
End Sub

Private Sub Form_Load()
Combo1.AddItem “11100013”
Combo1.AddItem “11100014”
Combo1.AddItem “11100156”
Combo1.AddItem “10100157”
End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text4.SetFocus
End If
End Sub

Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text5.SetFocus
End If
End Sub

Private Sub Text5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text6.SetFocus
End If
End Sub

KODE PROGRAM:PERHITUNGAN GAJI KARYAWAN

Private Sub CMDLAGI_Click()
kosong
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 “V”
gapok = 3500000
tunjangan = 350000
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 cmdBATAL_Click()
txtnidn.SetFocus
txtnidn.Text = “”
txtnama.Text = “”
cbogolongan.Text = “”
txtgapok.Text = “”
txttunjangan.Text = “”
txtpajak.Text = “”
txttotal.Text = “”
End Sub

Private Sub CMDKELUAR_Click()
Unload Me
End Sub

Private Sub Form_Load()
cbogolongan.AddItem “I”
cbogolongan.AddItem “II”
cbogolongan.AddItem “III”
cbogolongan.AddItem “IV”
cbogolongan.AddItem “V”
End Sub

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

PRAKTIKUM VISUAL BASIC 6.0

KODE PROGRAM:
Private Sub CMDEXIT_Click()
Unload Me
End Sub

Private Sub CMDLAGI_Click()
TXTKODE.SetFocus
TXTKODE = “”
TXTNAMA = “”
TXTJUMLAH = “”
TXTHARGA = “”
txttotal = “”
End Sub

Private Sub cmdPROSES_Click()
txttotal = Val(TXTJUMLAH.Text) * Val(TXTHARGA.Text)
End Sub

Private Sub TXTJUMLAH_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TXTHARGA.SetFocus
End If
End Sub

Private Sub TXTKODE_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TXTNAMA.SetFocus
End If
End Sub
Private Sub TXTNAMA_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TXTJUMLAH.SetFocus
End If
End Sub

KODE PROGRAM:
Private Sub Command1_Click()
TXTRATA = Val((TXTTUGAS.Text) + Val(TXTKUIS.Text) + Val(TXTUTS.Text) + Val(TXTUAS.Text)) / 4
End Sub

Private Sub Command2_Click()
TXTNPM.SetFocus
TXTNPM = “”
TXTNAMA = “”
TXTTUGAS = “”
TXTKUIS = “”
TXTUTS = “”
TXTUAS = “”
TXTRATA = “”
End Sub

Private Sub Command3_Click()
Unload Me
End Sub

Private Sub TXTKUIS_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TXTUTS.SetFocus
End If
End Sub

Private Sub TXTNAMA_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TXTTUGAS.SetFocus
End If
End Sub

Private Sub TXTNPM_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TXTNAMA.SetFocus
End If
End Sub

Private Sub TXTTUGAS_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TXTKUIS.SetFocus
End If
End Sub

Private Sub TXTUTS_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TXTUAS.SetFocus
End If
End Sub

KODE PROGRAM:
Private Sub Command1_Click()
Dim a, b, c, d As Double
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.Text = “”
Text2.Text = “”
Text3.Text = “”
End Sub
Private Sub Command6_Click()
Unload Me
End Sub
Private Sub Command7_Click()
Text3.Text = Val(Text1.Text) ^ Val(Text2.Text)
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub

KODE PROGRAM:
Private Sub YES_Click()
txtnama.SetFocus
txtnama.Text = “”
Txtnpm.Text = “”
txtkelas.Text = “”
txtjurusan.Text = “”
End Sub
Private Sub cmdclose_Click()
Unload Me
End Sub
Private Sub CMDYES_Click()
txtnama.SetFocus
txtnama.Text = “”
Txtnpm.Text = “”
txtkelas.Text = “”
txtjurusan.Text = “”
End Sub
Private Sub Form_Load()
txtnama.Text = “”
Txtnpm.Text = “”
txtkelas.Text = “”
txtjurusan.Text = “”
End Sub
Private Sub txtkelas_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtjurusan.SetFocus
End If
End Sub
Private Sub txtnama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Txtnpm.SetFocus
End If
End Sub
Private Sub Txtnpm_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtkelas.SetFocus
End If
End Sub

KODE PROGRAM:
Private Sub cmdkeluar_Click()
MsgBox “ANDA INGIN KELUAR ?”, vbQuestion + vbYesNo
Unload Me
End Sub
Private Sub cmdlagi_Click()
Text1.SetFocus
Text1.Text = “”
Text2.Text = “”
Text3.Text = “”
Text4.Text = “”
Text5.Text = “”
Text6.Text = “”
End Sub
Private Sub cmdproses_Click()
Dim s As String
Text5.Text = “20” & Left(Text2.Text, 2)
s = Mid(Text2.Text, 3, 1)
If s = “1” Then
Text3.Text = “sistem informasi”
ElseIf s = “2” Then
Text3.Text = “manajemen informatika”
ElseIf s = Text3.Text = “3” Then
Text3.Text = “teknik informatika”
ElseIf s = “4” Then
Text3.Text = “manajemen komputer”
End If
s = Mid(Text2.Text, 3, 2)
If s = “10” Then
Text4.Text = “strata satu”
ElseIf s = “20” Then
Text4.Text = “diploma tiga”
ElseIf s = “30” Then
Text4.Text = “diploma dua”
ElseIf s = “40” Then
Text4.Text = “diploma satu”
End If
Text6.Text = Right(Text2.Text, 3)
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub

Posted on December 19, 2011, in Uncategorized. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: