Sabtu, 21 April 2012

Visual Basic


Object
Properties
Keterangan
Label1
Caption
Gaji karyawan

Name
Label1
Label2
Caption
Gaji

Name
Label2
Label3
Caption
Kelbihan jam

Name
Label3
Label4
Caption
Bonus gaji

Name
Label4
Label5
Caption
Apakah Terlambat

Name
Label5
Label6
Caption
Hadiah

Name
Label6
Label7
Caption
Total gaji

Name
Label7
Label8
Name
Label8
Label9
Name
Label9
Label10
Name
Label10
Label11
Caption
Y/N

Name
Label11
Text1
Name
Text1
Text2
Name
Text2
Text3
Name
Text3
Command1
Caption
Prosses

Name
Command1
Command2
Caption
Clear

Name
Command2
Command3
Caption
Aktif

Name
Command3
Command4
Caption
Exit

name
Command4



Codingnya
Private Sub Command1_Click()
Label7.Caption = Val(Text2.Text) * 30000
Label9.Caption = Val(Label7.Caption) + Val(Text4.Text) + Val(Text1.Text) + Val(Label8.Caption)
If Text4.Text = "Y" Then Label8.Caption = Val(Text1.Text) * 10 / 100
If Text4.Text = "N" Then Label8.Caption = Val(Text1.Text) - 2500
End Sub

Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Label7.Caption = ""
Label8.Caption = ""
Label9.Caption = ""
Text4.Text = ""
End Sub

Private Sub Command3_Click()
Text1.Enabled = 1
Text2.Enabled = 1
Label7.Enabled = 1
Text4.Enabled = 1
Label9.Enabled = 1
Command1.Enabled = 1
Command2.Enabled = 1
Command4.Enabled = 1
Label8.Enabled = 1
MsgBox "Aplikasi Aktif..Selamat Menghitung"
End Sub

Private Sub Command4_Click()
MsgBox "Exit"
End
End Sub

Private Sub Form_Load()
Text1.Enabled = 0
Text2.Enabled = 0
Label7.Enabled = 0
Text4.Enabled = 0
Label9.Enabled = 0
Label8.Enabled = 0
Command1.Enabled = 0
Command2.Enabled = 0
Command4.Enabled = 0
End Sub


Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    If Text1.Text = "" Then
    Text2.SetFocus
    Else
   Command1.SetFocus
   End If
End If
If Not (KeyAscii >= Asc("0") & Chr(13) And KeyAscii <= Asc("9") & Chr(13) Or KeyAscii = 13 Or KeyAscii = vbKeyBack Or KeyAscii = vbKeyDelete) Then
KeyAscii = 0
MsgBox " Hanya Boleh Angka saja"
End If
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
If Not (KeyAscii >= Asc("0") & Chr(13) And KeyAscii <= Asc("9") & Chr(13) Or KeyAscii = 13 Or KeyAscii = vbKeyBack Or KeyAscii = vbKeyDelete) Then
KeyAscii = 0
MsgBox " Hanya Boleh Angka saja"
End If
If KeyAscii = 13 Then
    If Text2.Text = "" Then
    Text4.SetFocus
    Else
    Command2.SetFocus
    End If
End If
End Sub

0 komentar:

Posting Komentar

Template by:

Free Blog Templates