MENDESAIN FORM MENGGUNAKAN OPTIONBOX, COMBOBOX PADA
PROGRAM ARITMATIKA
MENGUNAKAN VISUAL BASIC 6.0
06 maret 2012, jojo
Klik Start > Microsoft visual studio > Visual basic 6.0 > Standard
EXE > Open
Desain Form seperti
gambar dibawah !
Menggunakan : 1 buah Combobox
2 buah optionBox
12 buah text box
18 buah Label
2 buah commandbotton
CAPTIONS
|
KOMPONEN
|
Gaji karyawan
|
Form1
|
Nomor induk karyawan
|
Text1
|
Nama karyawan
|
Text2
|
Masa kerja
|
Text3
|
Status perkawinan
|
Optionbox1
menikah
Optionbox2
belum menikah
|
Pembayaran gaji bulan
|
Combobox1
|
Gaji pokok
|
Text4
|
Tunjangan istri
|
Text5
|
Jumlah Anak
|
Text6
|
Tunjangan Anak
|
Text7
|
Jumlah Hari kerja
|
Text8
|
Honor Gaji Kerja
|
Text9
|
Total Gaji
|
Text10
|
Kasbon
|
Text11
|
Gaji Diterima bulan ini
|
Text12
|
Hitung gaji karyawan
Lagi
|
Commandbottton1
|
Selesai
|
c ommandbottton2
|
Dengan
ketentuan gambar:
1.
Gaji pokok ditentukan
berdasarkan masa kerja:
Masa Kerja
|
Gaji Pokok
|
<= 1th
|
500.000
|
2 th
|
750.000
|
3 th
|
1000000
|
4 th
|
1500000
|
>= 5 th
|
2500000
|
2.
Tunjangan istri damn anak
diberikan jika karyawan telah Menikah, Yaitu:
a.
Tunjangan Istri = 10% * Gaji
Pokok
b.
Tunjangan anak diberikan hanya
maksimal 3 orang anak yaitu ( 5% * Gaji
Pokok ) * Jumlah anak
3.
Honor hari kerja ditentukan
berdasarkan Masa kerja;
Masa Kerja
|
Honor Hari Kerja / Hari
|
<= 1th
|
25.000
|
2 th
|
30.000
|
3 th
|
40.000
|
4 th
|
55.000
|
>= 5 th
|
75.000
|
4.
Total Gaji = Gaji pokok +
tunjangan Istri + Tunjangan Anak + Honor Hari Kerja
5.
Gaji Diterima = Total Gaji –
Kasbon
Langkah Berikutnya setelah sobat mendesain form seperti ketentuan diatas
Sekarang sobat tinggal ketikkan project kodenya
seperti ini ni,,,,
Private Sub Form_Activate()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Combo1.AddItem "Januari"
Combo1.AddItem "Februari"
Combo1.AddItem "Maret"
Combo1.AddItem "April"
Combo1.AddItem "Mei"
Combo1.AddItem "Juni"
Combo1.AddItem "Juli"
Combo1.AddItem "Agustus"
Combo1.AddItem "September"
Combo1.AddItem "Oktober"
Combo1.AddItem "November"
Combo1.AddItem "Desember"
End Sub
Private Sub Option1_Click()
If Option1.Value = True Then
Text5.Text = Val(Text4.Text) * 0.1
Text6.SetFocus
End If
End Sub
Private Sub Option2_Click()
If Option2.Value = True Then
Text5.Text = 0
Text6.Text = 0
Text7.Text = 0
Text8.SetFocus
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As
Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text11_Change()
Text12.Text = Val(Text10.Text) -
Val(Text11.Text)
End Sub
Private Sub Text2_KeyPress(KeyAscii As
Integer)
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As
Integer)
If KeyAscii = 13 Then
Text6.SetFocus
End If
End Sub
Private Sub Text3_Change()
If Text3.Text = "1" Then
Text4.Text = "500000"
ElseIf Text3.Text = "2" Then
Text4.Text = "750000"
ElseIf Text3.Text = "3" Then
Text4.Text = "1000000"
ElseIf Text3.Text = "4" Then
Text4.Text = "1500000"
ElseIf Text3.Text = "5" Then
Text4.Text = "2500000"
End If
End Sub
Private Sub Text6_Change()
If Val(Text6.Text) <= 3 Then
Text7.Text = (Val(Text4.Text) * 0.05) *
Val(Text6.Text)
End If
End Sub
Private Sub Text6_KeyPress(KeyAscii As
Integer)
If KeyAscii = 13 Then
Text8.SetFocus
End If
End Sub
Private Sub Text8_Change()
If Text3.Text = "1" Then
Text9.Text = Val(Text8.Text) * 25000
ElseIf Text3.Text = "2" Then
Text9.Text = Val(Text8.Text) * 30000
ElseIf Text3.Text = "3" Then
Text9.Text = Val(Text8.Text) * 40000
ElseIf Text3.Text = "4" Then
Text9.Text = Val(Text8.Text) * 55000
ElseIf Text3.Text = "5" Then
Text9.Text = Val(Text8.Text) * 75000
End If
Text10.Text = (Val(Text4.Text) +
Val(Text5.Text) + Val(Text7.Text) + Val(Text9.Text))
End Sub
Private Sub Text8_KeyPress(KeyAscii As
Integer)
If KeyAscii = 13 Then
Text11.SetFocus
End If
End Sub
Private Sub Command1_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Combo1.Text = ""
Text1.SetFocus
End Sub
Private Sub Command2_Click()
End
End Sub
Okeyyy,,,,
Selamat mencoba sobat,
Thanks atas
kunjungannya,,,,
Tidak ada komentar:
Posting Komentar