latihan step by step visual basic
DESCRIPTION
Dengan Belajar Langkah demi Langkah, mulai membuat From kemudian pengaturan Propertiesnya seterunya membuat listing.....SELAMAT BELAJARTRANSCRIPT
Jawaban Quiz Tipe A
Objek-objek yang terkait :
Objeck Properties Nilai Form1 Caption Alga Musa Motor Label1 Caption Alga Musa Motor Data1 Name
Caption Database Name Recordset Type Record Source
Motor Data Motor Cari Difolder Masing2 0-Table Tbl_Motor
Frame1 Caption Pilihan Motor Yang Tersedia label Caption Menu Pilihan ComboBox1 Caption Combo1 Frame4 Caption Data Transaksi Label2 Caption Jenis Motor Label3 Caption Harga Motor Label4 Caption Jumlah Beli Label5 Caption Bayar Label6 Caption Potongan Label7 Caption Total Bayar Text1 Name
DataSource DataField Text
Text1 Motor Sesuaikan dengan fieldnya masing2 <Kosongkan>
Text2 Name DataSource DataField Text
Text 2 Motor Sesuaikan dengan fieldnya masing2 <Kosongkan>
Text3 Name DataSource DataField Text
Text 3 Motor Sesuaikan dengan fieldnya masing2 <Kosongkan>
Text4 Name DataSource DataField Text
Text4 Motor Sesuaikan dengan fieldnya masing2 <Kosongkan>
Text5 Name DataSource DataField Text
Text5 Motor Sesuaikan dengan fieldnya masing2 <Kosongkan>
Text6 Name DataSource DataField Text
Text6 Motor Sesuaikan dengan fieldnya masing2 <Kosongkan>
CommandButton1 Name Caption
Cmdtambah TAMBAH
CommandButton2 Name Caption
Cmdsimpan SIMPAN
CommandButton3 Name Caption
Cmdbatal BATAL
CommandButton4 Name Caption
Cmdhitung HITUNG
CommandButton5 Name Caption
Cmdkeluar KELUAR
Dbgrid1 Caption DataSource
DATA TRANSAKSI Motor
Listing Programnya: Private Sub cmdbatal_Click() MOTOR.Recordset.CancelUpdate MOTOR.Recordset.MoveLast End Sub Private Sub cmdhapus_Click() del = MsgBox("Record Mo Dihapus?", 36, "Konfirmasi") If del = 6 Then MOTOR.Recordset.Delete MOTOR.Recordset.MoveLast If MOTOR.Recordset.EOF Then MOTOR.Recordset.MoveLast End If End If End Sub Private Sub cmdhitung_Click() txtbayar.Text = Val(txtharga.Text) * Val(txtjumlah.Text) If txtjumlah > 5 Then txtpotong.Text = 2 / 100 * Val(txtbayar.Text) txttotal.Text = Val(txtbayar.Text) - Val(txtpotong.Text) Else txtpotong.Text = 0 txttotal = Val(txtbayar.Text) - Val(txtpotong.Text) End If End Sub Private Sub cmdkeluar_Click() psn = MsgBox("Anda Yakin Ingin Keluar", 32 + 4, "Informasi") If psn = vbYes Then MsgBox "Makasih Yach.........", 32, "informasi" End Else If psn = vbNo Then MsgBox "Lho.....kok enggak jadi toh", 32, "Informasi" End If End If End Sub Private Sub cmdsimpan_Click() If tambah = True Then MOTOR.Recordset.Update Else MOTOR.Recordset.Update End If End Sub
Private Sub cmdtambah_Click() tambah = True MOTOR.Recordset.AddNew txtjenis.SetFocus End Sub Private Sub Combo1_CLICK() If Combo1 = "SPR" Then txtjenis = "SUPRA" txtharga = 8000000 ElseIf Combo1 = "KRM" Then txtjenis = "KARISMA" txtharga = 8500000 ElseIf Combo1 = "LGD" Then txtjenis = "LAGENDA" txtharga = 8560000 ElseIf Combo1 = "WIN" Then txtjenis = "HONDA WIN" txtharga = 7500000 ElseIf Combo1 = "SHM" Then txtjenis = "SMESH" txtharga = 6500000 ElseIf Combo1 = "SGN" Then txtjenis = "SHOGUN" txtharga = 7800000 ElseIf Combo1 = "STR" Then txtjenis = "SATRIA" txtharga = 13000000 ElseIf Combo1 = "FGR" Then txtjenis = "FEGA R" txtharga = 12000000 ElseIf Combo1 = "JPR" Then txtjenis = "JUPITER" txtharga = 10000000 ElseIf Combo1 = "RXK" Then txtjenis = "RX KING" txtharga = 15000000 End If End Sub Private Sub Form_Load() tambah = False Combo1.AddItem "SPR" Combo1.AddItem "KRM" Combo1.AddItem "LGD" Combo1.AddItem "WIN" Combo1.AddItem "SHM" Combo1.AddItem "SGN" Combo1.AddItem "STR" Combo1.AddItem "FGR" Combo1.AddItem "JPR" Combo1.AddItem "RXK" End Sub Private Sub txtjumlah_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmdhitung.SetFocus End If End Sub
Jawaban Quiz Tipe B
Objek-objek yang terkait :
Objeck Properties Nilai Form1 Caption Alga Musa Motor Label1 Caption Alga Musa Motor Data1 Name
Caption Database Name Recordset Type Record Source
Motor Data Motor Cari Difolder Masing2 0-Table Tbl_Motor
Frame1 Caption Pilihan Motor Yang Tersedia label Caption Menu Pilihan List1 Caption List1 Frame4 Caption Data Transaksi Label2 Caption Jenis Motor Label3 Caption Harga Motor Label4 Caption Jumlah Beli Label5 Caption Bayar Label6 Caption Potongan Label7 Caption Total Bayar Text1 Name
DataSource DataField Text
Text1 Motor Sesuaikan dengan fieldnya masing2 <Kosongkan>
Text2 Name DataSource DataField Text
Text 2 Motor Sesuaikan dengan fieldnya masing2 <Kosongkan>
Text3 Name DataSource DataField Text
Text 3 Motor Sesuaikan dengan fieldnya masing2 <Kosongkan>
Text4 Name DataSource DataField Text
Text4 Motor Sesuaikan dengan fieldnya masing2 <Kosongkan>
Text5 Name DataSource DataField Text
Text5 Motor Sesuaikan dengan fieldnya masing2 <Kosongkan>
Text6 Name DataSource DataField Text
Text6 Motor Sesuaikan dengan fieldnya masing2 <Kosongkan>
CommandButton1 Name Caption
Cmdtambah TAMBAH
CommandButton2 Name Caption
Cmdsimpan SIMPAN
CommandButton3 Name Caption
Cmdbatal BATAL
CommandButton4 Name Caption
Cmdhitung HITUNG
CommandButton5 Name Caption
Cmdkeluar KELUAR
Dbgrid1 Caption DataSource
DATA TRANSAKSI Motor
Listing Programnya: Private Sub Form_Load() tambah = False List1.AddItem "SPR" List1.AddItem "KRM" List1.AddItem "LGD" List1.AddItem "WIN" List1.AddItem "SHM" List1.AddItem "SGN" List1.AddItem "STR" List1.AddItem "FGR" List1.AddItem "JPR" List1.AddItem "RXK" End Sub Private Sub List1_Click() If List1 = "SPR" Then txtjenis = "SUPRA" txtharga = 8000000 ElseIf List1 = "KRM" Then txtjenis = "KARISMA" txtharga = 8500000 ElseIf List1 = "LGD" Then txtjenis = "LAGENDA" txtharga = 8560000 ElseIf List1 = "WIN" Then txtjenis = "HONDA WIN" txtharga = 7500000 ElseIf List1 = "SHM" Then txtjenis = "SMESH" txtharga = 6500000 ElseIf List1 = "SGN" Then txtjenis = "SHOGUN" txtharga = 7800000 ElseIf List1 = "STR" Then txtjenis = "SATRIA" txtharga = 13000000 ElseIf List1 = "FGR" Then txtjenis = "FEGA R" txtharga = 12000000 ElseIf List1 = "JPR" Then txtjenis = "JUPITER" txtharga = 10000000 ElseIf List1 = "RXK" Then txtjenis = "RX KING" txtharga = 15000000 End If End Sub
Private Sub cmdbatal_Click() motor.Recordset.CancelUpdate motor.Recordset.MoveLast End Sub Private Sub cmdhapus_Click() del = MsgBox("Record Mo Dihapus?", 36, "Konfirmasi") If del = 6 Then motor.Recordset.Delete motor.Recordset.MoveLast If motor.Recordset.EOF Then motor.Recordset.MoveLast End If End If End Sub Private Sub cmdhitung_Click() txtbayar.Text = Val(txtharga.Text) * Val(txtjumlah.Text) If txtjumlah > 5 Then txtpotong.Text = 2 / 100 * Val(txtbayar.Text) txttotal.Text = Val(txtbayar.Text) - Val(txtpotong.Text) Else txtpotong.Text = 0 txttotal = Val(txtbayar.Text) - Val(txtpotong.Text) End If End Sub Private Sub cmdkeluar_Click() psn = MsgBox("Anda Yakin Ingin Keluar", 32 + 4, "Informasi") If psn = vbYes Then MsgBox "Makasih Yach.........", 32, "informasi" End Else If psn = vbNo Then MsgBox "Lho.....kok enggak jadi toh", 32, "Informasi" End If End If End Sub Private Sub cmdsimpan_Click() If tambah = True Then motor.Recordset.Update Else motor.Recordset.Update End If End Sub Private Sub cmdtambah_Click() tambah = True motor.Recordset.AddNew txtjenis.SetFocus End Sub Private Sub txtjumlah_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmdhitung.SetFocus End If End Sub