√ Menciptakan Form Jasa Pembuatan Sim Di Vb 6.0
Konten [Tampil]
1. Buatlah Form menyerupai dibawah ini :
2. Ubah Name pada masing-masing textbox/commnadbutton/combobox/option button
3. Salinlah arahan listing / source code berikut :
Private Sub Check1_Click()
If Check1.Value = 1 Then
sima.Text = 150000
Else
sima.Text = 0
End If
End Sub
Private Sub Check2_Click()
If Check2.Value = 1 Then
simc.Text = 200000
Else
simc.Text = 0
End If
End Sub
Private Sub Check3_Click()
If Check3.Value = 1 Then
simb.Text = 180000
Else
simb.Text = 0
End If
End Sub
Private Sub domisili_Click()
If domisili.Text = ("Jakarta") Then
admin.Text = 10000
Else
If domisili.Text = ("Banten") Then
admin.Text = 20000
Else
If domisili.Text = ("Bekasi") Then
admin.Text = 15000
End If
End If
End If
End Sub
Private Sub Form_Load()
Call bersih
Call tidakaktif
domisili.AddItem ("Jakarta")
domisili.AddItem ("Banten")
domisili.AddItem ("Bekasi")
End Sub
Private Sub hitung_Click()
total.Text = Val(admin.Text) + Val(sima.Text) + Val(simb.Text) + Val(simc.Text) + Val(harga.Text)
End Sub
Private Sub input_Click()
Call bersih
Call aktif
ktp.SetFocus
End Sub
Private Sub keluar_Click()
X = MsgBox("yakin ingin keluar dari sini?", vbCritical + vbOKCancel, "Warning")
If X = vbOK Then
End
End If
End Sub
Private Sub Option1_Click()
harga.Text = 150000
End Sub
Private Sub Option2_Click()
harga.Text = 25000
End Sub
Private Sub Option3_Click()
harga.Text = 50000
End Sub
Private Sub Option4_Click()
harga.Text = 100000
End Sub
Private Sub Timer1_Timer()
jam.Caption = Time()
tanggal.Caption = Format(Date, "dddd, dd-mmmm-yyyy")
End Sub
Sub bersih()
ktp.Text = ""
nama.Text = ""
alamat.Text = ""
lahir.Text = ""
telp.Text = ""
domisili.Text = "-pilih-"
admin.Text = ""
harga.Text = ""
total.Text = ""
sima.Text = "0"
simb.Text = "0"
simc.Text = "0"
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
End Sub
Sub tidakaktif()
ktp.Enabled = False
nama.Enabled = False
alamat.Enabled = False
lahir.Enabled = False
telp.Enabled = False
domisili.Enabled = False
admin.Enabled = False
harga.Enabled = False
total.Enabled = False
sima.Enabled = False
simb.Enabled = False
simc.Enabled = False
End Sub
Sub aktif()
ktp.Enabled = True
nama.Enabled = True
alamat.Enabled = True
lahir.Enabled = True
telp.Enabled = True
domisili.Enabled = True
admin.Enabled = True
harga.Enabled = True
total.Enabled = True
sima.Enabled = True
simb.Enabled = True
simc.Enabled = True
End Sub
Sumber http://www.hendrisetiawan.com
If Check1.Value = 1 Then
sima.Text = 150000
Else
sima.Text = 0
End If
End Sub
Private Sub Check2_Click()
If Check2.Value = 1 Then
simc.Text = 200000
Else
simc.Text = 0
End If
End Sub
Private Sub Check3_Click()
If Check3.Value = 1 Then
simb.Text = 180000
Else
simb.Text = 0
End If
End Sub
Private Sub domisili_Click()
If domisili.Text = ("Jakarta") Then
admin.Text = 10000
Else
If domisili.Text = ("Banten") Then
admin.Text = 20000
Else
If domisili.Text = ("Bekasi") Then
admin.Text = 15000
End If
End If
End If
End Sub
Private Sub Form_Load()
Call bersih
Call tidakaktif
domisili.AddItem ("Jakarta")
domisili.AddItem ("Banten")
domisili.AddItem ("Bekasi")
End Sub
Private Sub hitung_Click()
total.Text = Val(admin.Text) + Val(sima.Text) + Val(simb.Text) + Val(simc.Text) + Val(harga.Text)
End Sub
Private Sub input_Click()
Call bersih
Call aktif
ktp.SetFocus
End Sub
Private Sub keluar_Click()
X = MsgBox("yakin ingin keluar dari sini?", vbCritical + vbOKCancel, "Warning")
If X = vbOK Then
End
End If
End Sub
Private Sub Option1_Click()
harga.Text = 150000
End Sub
Private Sub Option2_Click()
harga.Text = 25000
End Sub
Private Sub Option3_Click()
harga.Text = 50000
End Sub
Private Sub Option4_Click()
harga.Text = 100000
End Sub
Private Sub Timer1_Timer()
jam.Caption = Time()
tanggal.Caption = Format(Date, "dddd, dd-mmmm-yyyy")
End Sub
Sub bersih()
ktp.Text = ""
nama.Text = ""
alamat.Text = ""
lahir.Text = ""
telp.Text = ""
domisili.Text = "-pilih-"
admin.Text = ""
harga.Text = ""
total.Text = ""
sima.Text = "0"
simb.Text = "0"
simc.Text = "0"
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
End Sub
Sub tidakaktif()
ktp.Enabled = False
nama.Enabled = False
alamat.Enabled = False
lahir.Enabled = False
telp.Enabled = False
domisili.Enabled = False
admin.Enabled = False
harga.Enabled = False
total.Enabled = False
sima.Enabled = False
simb.Enabled = False
simc.Enabled = False
End Sub
Sub aktif()
ktp.Enabled = True
nama.Enabled = True
alamat.Enabled = True
lahir.Enabled = True
telp.Enabled = True
domisili.Enabled = True
admin.Enabled = True
harga.Enabled = True
total.Enabled = True
sima.Enabled = True
simb.Enabled = True
simc.Enabled = True
End Sub