database toko material

Capture.PNG

Private Sub Cbgolongan_load()

cbogolongan.AddItem “BESI”

cbogolongan.AddItem “CAIR”

cbogolongan.AddItem “BUBUK/PADAT”

cbogolongan.AddItem “PLASTIK”

 

End Sub

 

Private Sub Cbgolongan_Click()

Dim KODE, NAMBA, JUMABA, HARGA,TOTAL As Variant

Select Case Cbgolongan.Text

Case “BESI”

HARGA = 11000 /KG

Case “CAIR”

HARGA = 5000/KG

Case “PADAT”

HARGA = 4500 /KG

Case “PLASTIK”

HARGA = 3000/KG

Case Else

End Select

total = TXTXJUMABA.text x txtHARGA.text

End Sub

 

Private Sub Command1_Click()

Data1.Recordset.Update

 

End Sub

 

Private Sub Command2_Click()

Data1.Recordset.AddNew

End Sub

 

Private Sub Command3_Click()

Data1.Recordset.Delete

End Sub

 

Private Sub ComdBATAL_Click()

kosong

End Sub

Public Sub kosong()

TxtKODE.SetFocus

TxtNAMABA.Text = “”

Cbgolongan.Text = “”

TxtJUMABA.Text = “”

TxtHARGA.Text = “”

TxtTOTAL.Text = “”

End Sub

Private Sub ComDKELUAR_Click()

Unload Me

End Sub

 

Private Sub ComdLAGI_Click()

kosong

End Sub

 

 

Private Sub DBGrid1_Click()

 

End Sub

 

Private Sub Form_Load()

Cbgolongan.AddItem “BESI”

Cbgolongan.AddItem “CAIR”

Cbgolongan.AddItem “BUBUK/PADAT”

Cbgolongan.AddItem “PLASTIK”

 

End Sub

Private Sub Text1_Change()

End Sub

Private Sub TxtKODE_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

TxtNAMABA.SetFocus

End If

End Sub

 

Iklan

pembuatan database VB.6 ke-2

6. pembuatan database untuk data buku kampus

DBKE6

. Private Sub ComdBATAL_Click()

Cbkode.SetFocus

Cbkode.Text = “”

Textjudul.Text = “”

Textpeng.Text = “”

TextTT.Text = “”

Textpene.Text = “”

Textharga.Text = “”

End Sub

 

Private Sub ComdKELUAR_Click()

Unload Me

End Sub

 

Private Sub ComdLAGI_Click()

Cbkode.SetFocus

Cbkode.Text = “”

Textjudul.Text = “”

Textpeng.Text = “”

TextTT.Text = “”

Textpene.Text = “”

Textharga.Text = “”

End Sub

 

Private Sub ComdPROSES_Click()

Dim judul, pengarang, harga As String

Y = Mid(Cbkode.Text, 3, 3)

If Y = “SIM” Then

Textjudul.Text = “Sistem Informasi Manajeme”

Textpeng.Text = “Yati Nur Oktavia”

Textharga.Text = “75900”

ElseIf Y = “EDP” Then

Textjudul.Text = “Elektronik Data Processing”

Textpeng.Text = “Imam Tarmizi”

Textharga.Text = “62000”

ElseIf Y = “CDR” Then

Textjudul.Text = “Corel Draw”

Textpeng.Text = “Riyan Suhandi”

Textharga.Text = “53000”

ElseIf Y = “MNJ” Then

Textjudul.Text = “Manajemen”

Textpeng.Text = “Valentina Mariana Adiwianti”

Textharga.Text = “42000”

ElseIf Y = “RPL” Then

Textjudul.Text = “Rekayasa Perangkat Lunak”

Textpeng.Text = “Sinta Umpu Singa”

Textharga.Text = “83000”

End If

TextTT.Text = “20” & Right(Cbkode.Text, 2)

Dim S As String

S = Left(Cbkode.Text, 1)

If S = “A” Then

Textpene.Text = “Andi Offset Yogyakarta”

ElseIf S = “I” Then

Textpene.Text = “Indah Surabaya”

S = Left(Cbkode.Text, 1)

ElseIf S = “S” Then

Textpene.Text = “Salemba Empat”

ElseIf S = “M” Then

Textpene.Text = “Maxicom”

ElseIf S = “E” Then

Textpene.Text = “Elek Media Komputindo”

 

End If

 

End Sub

 

Private Sub Command1_Click()

Data1.Recordset.AddNew

End Sub

 

Private Sub Command2_Click()

Data1.Recordset.Update

End Sub

 

Private Sub Command3_Click()

Data1.Recordset.Delete

End Sub

 

Private Sub Form_Load()

Cbkode.AddItem “A-SIM-01”

Cbkode.AddItem “I-EDP-02”

Cbkode.AddItem “S-MNJ-03”

Cbkode.AddItem “E-CDR-04”

Cbkode.AddItem “M-RPL-05”

 

End Sub

7.database penjualan tike kereta api

DBKE7

. Private Sub ComdKELUAR_Click()

Unload Me

End Sub

 

Private Sub ComdLAGI_Click()

TextKODE.SetFocus

TextKODE.Text = “”

TextHARGA.Text = “”

TextJK.Text = “”

TextJB.Text = “”

TextJT.Text = “”

TextTOTAL.Text = “”

End Sub

 

Private Sub ComdPROSES_Click()

Dim harga, A, jk, jb, jt As Variant

A = Left(TextKODE.Text, 3)

If A = “BIM” Then

TextHARGA.Text = “750000”

TextJK = “BIMA pringsewu”

TextJB.Text = “16:00”

ElseIf A = “EKO” Then

TextHARGA.Text = “40000”

TextJK = “EKONOMI Pringsewu”

TextJB.Text = “19:00”

ElseIf A = “MUT” Then

TextHARGA.Text = “1000000”

TextJK = “MUTIARA pringsewu”

TextJB.Text = “17:00”

ElseIf A = “SEN” Then

TextHARGA.Text = “85000”

TextJK = “SENJA pringsewu”

TextJB.Text = “20:00”

End If

TextJT.SetFocus

End Sub

 

Private Sub Command1_Click()

Data1.Recordset.Update

End Sub

 

Private Sub Command2_Click()

Data1.Recordset.AddNew

End Sub

 

Private Sub Command3_Click()

Data1.Recordset.Delete

End Sub

 

Private Sub TextJT_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

TextTOTAL.Text = Val(TextJT) * Val(TextHARGA)

End If

End Sub

8. data base buku kampus

DBKE8

Private Sub ComdKELUAR_Click()

Unload Me

End Sub

 

Private Sub ComdLAGI_Click()

TextKODE.SetFocus

TextKODE.Text = “”

TextHARGA.Text = “”

TextpENG.Text = “”

Textpene.Text = “”

TextTT.Text = “”

TextJB.Text = “”

End Sub

 

Private Sub ComdPROSES_Click()

Dim A As String

A = Left(TextKODE.Text, 3)

If A = “SIM” Then

TextJB.Text = “Sistem Informasi Manajemen”

TextpENG.Text = “RIYAN ALFARIZI”

TextHARGA.Text = “75900”

ElseIf A = “EDP” Then

TextJB.Text = “Elektronik Data Processing”

TextpENG.Text = “LAILATULROHMAH”

TextHARGA.Text = “62000”

ElseIf A = “MNJ” Then

TextJB.Text = “Manajemen”

TextpENG.Text = “DAVID BUDIANTO”

TextHARGA.Text = “82000”

ElseIf A = “CDR” Then

TextJB.Text = “Corel Draw”

TextpENG.Text = “GILBERT ALEX”

TextHARGA.Text = “53000”

ElseIf A = “RPL” Then

TextJB.Text = “Rekayasa Perangkat Lunak”

TextpENG.Text = “Winda Erlianti”

TextHARGA.Text = “83000”

End If

M = Right(TextKODE.Text, 1)

If M = “A” Then

Textpene.Text = “Andi Offset Yogyakarta”””

ElseIf M = “I” Then

Textpene.Text = “Indah Surabaya”

ElseIf M = “S” Then

Textpene.Text = “Salemba Empat”

ElseIf M = “E” Then

Textpene.Text = “Elek Media Komputindo”

ElseIf M = “M” Then

Textpene.Text = “Maxicom”

End If

TextTT.Text = “20” & Mid(TextKODE.Text, 5, 2)

End Sub

 

Private Sub Command1_Click()

Data1.Recordset.Update

End Sub

 

Private Sub Command2_Click()

Data1.Recordset.AddNew

End Sub

 

Private Sub Command3_Click()

Data1.Recordset.Delete

End Sub

9. database karyawan PT.

DBKE9

Private Sub ComdBATAL_Click()

TextNAMA.SetFocus

TextNAMA.Text = “”

TextNIK.Text = “”

TextGOL.Text = “”

TextKODE.Text = “”

TextSTAT.Text = “”

TextTAHU.Text = “”

TextJABA.Text = “”

TextBAGI.Text = “”

TextGAPOK.Text = “”

TextTUNJA.Text = “”

TextTOTAL.Text = “”

End Sub

 

Private Sub ComdKELUAR_Click()

Unload Me

End Sub

 

Private Sub ComdLAGI_Click()

TextNAMA.SetFocus

TextNAMA.Text = “”

TextNIK.Text = “”

TextGOL.Text = “”

TextKODE.Text = “”

TextSTAT.Text = “”

TextTAHU.Text = “”

TextJABA.Text = “”

TextBAGI.Text = “”

TextGAPOK.Text = “”

TextTUNJA.Text = “”

TextTOTAL.Text = “”

End Sub

 

Private Sub ComdPROSES_Click()

Dim GOL, KODE, GAPOK, TOTAL, Y, TUNJA As Variant

TextTAHU.Text = Left(TextNIK.Text, 4)

Y = Mid(TextNIK.Text, 5, 1)

If Y = “A” Then

TextGOL.Text = “A”

TextJABA.Text = “MANAJER”

TextGAPOK.Text = “4000000”

TextTUNJA.Text = “1025000”

ElseIf Y = “B” Then

TextGOL.Text = “B”

TextJABA.Text = “KA.SEKSI”

Text.GAPOK.Text = “3500000”

TextTUNJA.Text = “975000”

ElseIf Y = “C” Then

TextGOL.Text = “C”

TextJABA.Text = “STAFF”

TextTUNJA.Text = “925000”

TextGAPOK.Text = “3000000”

End If

Y = Right(TextNIK.Text, 3)

If Y = “ADM” Then

TextBAGI.Text = “Administrasi”

ElseIf Y = “KEU” Then

TextBAGI.Text = “Accounting”

ElseIf Y = “SDM” Then

TextBAGI.Text = “General Affair”

ElseIf Y = “EDP” Then

TextBAGI.Text = “IT Unit”

ElseIf Y = “SPM” Then

TextBAGI.Text = “Security”

End If

Y = Mid(TextNIK.Text, 7, 1)

If Y = “S” Then

TextKODE.Text = “S”

TextSTAT.Text = “Single”

ElseIf Y = “M” Then

TextKODE.Text = “M”

TextSTAT.Text = “Menikah”

ElseIf Y = “J” Then

TextKODE.Text = “”

TextSTAT.Text = “Janda”

ElseIf Y = “D” Then

TextKODE.Text = “D”

TextSTAT.Text = “Duda”

End If

TextTOTAL.Text = Val(TextGAPOK) + Val(TextTUNJA)

 

End Sub

 

Private Sub Command1_Click()

Data1.Recordset.Update

End Sub

 

Private Sub Command2_Click()

Data1.Recordset.AddNew

End Sub

 

Private Sub Command3_Click()

Data1.Recordset.Delete

End Sub

 

Private Sub TextNAMA_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

TextNIK.SetFocus

End If

End Sub

10. database penjualan alat tulis & penambaha form 2

db10

Private Sub Text3_Change()

 

End Sub

 

Private Sub Text2_Change()

 

End Sub

 

Private Sub Command1_Click()

txtkode.SetFocus

End Sub

 

Private Sub Command2_Click()

txtkode.SetFocus

txtkode.Text = “”

textnb.Text = “”

txthb.Text = “”

txtjb.Text = “”

txtby.Text = “”

txtpot.Text = “”

txtttb.Text = “”

End Sub

 

Private Sub Command3_Click()

txtby.Text = Val(txthb.Text) * Val(txtjb.Text)

If txtjb.Text > 5 Then

txtpot.Text = 2 / 100 * Val(txtby.Text)

ElseIf txtjb.Text < 5 Then

txtpot.Text = 1 * Val(txtby.Text)

End If

txtttb.Text = Val(txtby.Text) – Val(txtpot.Text)

End Sub

 

Private Sub Command4_Click()

Form2.Show

Unload Me

End Sub

 

Private Sub Command5_Click()

Data1.Recordset.AddNew

 

 

End Sub

 

Private Sub Command6_Click()

Dim nama, harga As String

Y = Mid(txtkode.Text, 5, 2)

If Y = “SP” Then

textnb.Text = “SPIDOL”

txthb.Text = “9500”

ElseIf Y = “BT” Then

textnb.Text = “buku tulis”

txthb.Text = “12500”

ElseIf Y = “TP” Then

textnb.Text = “TIPE EX”

txthb.Text = “3000”

ElseIf Y = “PG” Then

textnb.Text = “PENGGARIS”

txthb.Text = “25000”

ElseIf Y = “PT” Then

textnb.Text = “PAPAN TULIS”

txthb.Text = “50000”

 

End If

txtjb.SetFocus

End Sub

db10-2

Private Sub Command1_Click()

Unload Me

End Sub

 

Private Sub Command2_Click()

Form1.Show

End Sub

you can try it!!!!

Pembuatan database VB.6

Jalankan program Visual Basic 6.0

Add-Ins à Visual Data Manager à tampil VisData 1

Pada jendela VisData, klik meu File à New à Microsoft Access, pilih Version 7. 0 MDB. Selanjutnya, tampil kotak dialog Select Microsoft Access Database to Create seperti pada gambar berikut :

2

Pada bagiann Save in, tentukan lokasi di mana file database tersebut akan anda simpan.

Pada bagian File Name, ketik nama file databasenya.

3

Setelah file Database Anda buat, Annda dapat menambahkan satu atau beberapa tabel dalam database. Langkah-langkah yang Anda lakukan :

Pada jendela VisData pada Properties, pilih New Table sehingga akan tampil Tabel Structure seperti :

4 5

Kontrol Data merupakan sebuah kontrol yang digunakan untuk menghubungkan aplikasi program dengan database.

PROPERTI KETERANGAN
DatabaseName Untuk dihubungkan dengan file databasenya
RecordSource Untuk menentukan nama tabel atau query yang akan dihubungkan dengan kontrol

PENJE1

Berikut adalah properti yang sering digunakan pada kontrol data :

Anda dapat meghubungkan kontrol lain ke database melalui kontrol

Data. Beberapa kontrol lain : TextBox, Label, ListBox, ComboBox,

Image, dan Picture. Ada dua properti penting :

  1. DataSource à untuk dihubungkan dgn kontrol Data
  2. DataField à untuk menentukan field mana yang akan dihubugkan

DBGrid     merupakan kontrol yang digunakan untuk Menampilkan data record dari koneksi kontrol data.

Untuk menambahkan kontrol tersebut :

  1. Klik menu project, pilih Components (CTRL+T)
  2. Microsoft Data Bound Grid Control 5.0 (SP3)
  3. Ok

PENJE2 PENJE3

jika sudah dibuat form nya maka kita langsung ke tugas 1-5

  1. DBKE1
  1. Private Sub Cbgolongan_load()

cbogolongan.AddItem “I”

cbogolongan.AddItem “II”

cbogolongan.AddItem “III”

cbogolongan.AddItem “IV”

 

End Sub

 

Private Sub Cbgolongan_Click()

Dim gapok, pajak, tunjangan, total As Variant

Select Case Cbgolongan.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 Else

gapok = 0

tunjangan = 0

End Select

total = gapok + tunjangan

pajak = total * 0.1

TxtGAPOK.Text = gapok

TxtTUNJA.Text = tunjangan

TxtPAJAK.Text = pajak

TxtTOTAL.Text = total – pajak

End Sub

Private Sub Command1_Click()

Data1.Recordset.Update

End Sub

Private Sub Command2_Click()

Data1.Recordset.AddNew

End Sub

 

Private Sub Command3_Click()

Data1.Recordset.Delete

End Sub

 

Private Sub ComdBATAL_Click()

kosong

End Sub

Public Sub kosong()

TxtNIDN.SetFocus

TxtNIDN.Text = “”

TxtNAMA.Text = “”

Cbgolongan.Text = “”

TxtGAPOK.Text = “”

TxtTUNJA.Text = “”

TxtPAJAK.Text = “”

TxtTOTAL.Text = “”

End Sub

Private Sub ComDKELUAR_Click()

Unload Me

End Sub

 

Private Sub ComdLAGI_Click()

kosong

End Sub

Private Sub Form_Load()

Cbgolongan.AddItem “I”

Cbgolongan.AddItem “II”

Cbgolongan.AddItem “III”

Cbgolongan.AddItem “IV”

End Sub

Private Sub Text1_Change()

End Sub

 

Private Sub TxtNIDN_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

TxtNAMA.SetFocus

End If

End Sub

2. aplikasi database untuk prodi mahasiswa

DBKE2

Private Sub cmdbatal_Click()

Textnama.SetFocus

Textnama = “”

Textnpm = “”

Textjur = “”

Textps = “”

Texttm = “”

Textnu = “”

End Sub

 

Private Sub Cmdkeluar_Click()

End

End Sub

 

Private Sub cmdlagi_Click()

Textnama.SetFocus

Textnama = “”

Textnpm = “”

Textjur = “”

Textps = “”

Texttm = “”

Textnu = “”

End Sub

 

Private Sub Cmdproses_Click()

Dim A As String

Texttm = “20” & Left(Textnpm, 2)

A = Mid(Textnpm, 3, 3)

If A = “100” Then

Textjur = “sistem informasi”

Textps = “strata 1”

ElseIf A = “200” Then

Textjur = “manajemen informatika”

Textps = “diploma 3”

ElseIf A = “300” Then

Textjur = “teknik informatika”

Textps = “diploma 4”

ElseIf A = “400” Then

Textjur = “komputer akutansi”

Textps = “diploma 2”

End If

Textnu = Right(Textnpm, 3)

End Sub

 

Private Sub Command1_Click()

Data1.Recordset.Update

End Sub

 

Private Sub Command2_Click()

Data1.Recordset.AddNew

End Sub

 

Private Sub Command3_Click()

Data1.Recordset.Delete

End Sub

 

Private Sub Textnama_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Textnpm.SetFocus

End If

End Sub

3. database penentu pada NPM mahasiswa

DBKE3

.

Private Sub cmdbatal_Click()

Textnama.SetFocus

Textnama = “”

Textnpm = “”

Textjur = “”

Textps = “”

Texttm = “”

Textnu = “”

End Sub

 

Private Sub cmdkeluar_Click()

End

End Sub

 

Private Sub cmdlagi_Click()

Textnama.SetFocus

Textnama = “”

Textnpm = “”

Textjur = “”

Textps = “”

Texttm = “”

Textnu = “”

End Sub

 

Private Sub Cmdproses_Click()

Dim jr As String

Dim ps As String

Dim A As String

A = Mid(Textnpm, 3, 1)

If A = 1 Then

jr = “sistem informasi”

ElseIf A = 2 Then

jr = “teknik informatika”

ElseIf A = 3 Then

jr = “menejemen informatika”

ElseIf A = 4 Then

jr = “komputer akuntansi”

End If

Textjur = jr

 

A = Mid(Textnpm, 4, 2)

If A = “01” Then

ps = “strata 1”

ElseIf A = “02” Then

ps = “diploma 4”

ElseIf A = “03” Then

ps = “diploma 3”

ElseIf A = “04” Then

ps = “diploma 2”

End If

Textps = ps

Texttm = “20” & Left(Textnpm, 2)

Textnu = Right(Textnpm, 3)

End Sub

 

Private Sub Textnama_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Textnpm.SetFocus

End If

End Sub

 

Private Sub Command1_Click()

Data1.Recordset.Update

End Sub

 

Private Sub Command2_Click()

Data1.Recordset.AddNew

End Sub

Private Sub Command3_Click()

Data1.Recordset.Delete

End Sub

4. entri penjualan laptop dengan menyisipkan  database

DBKE4

Private Sub CbKODE_Click()

Dim MERK, HS As Variant

Select Case CbKODE.Text

Case “Apple MC965 MacBook Air”

MERK = “Apple MacBook Air MC965”

HS = 12800000

Case “Apple MC966 MacBook Air”

MERK = “Apple MacBook Air MC966”

HS = 15800000

Case “Apple MC968 MacBook Air”

MERK = “Apple MacBook Air MC968”

HS = 9900000

Case “Apple MC969 MacBook Air”

MERK = “Apple MacBook Air MC969”

HS = 11900000

Case “Apple MC700 MacBook Pro”

MERK = “Apple MacBook Pro MC700”

HS = 10800000

Case “Apple MC721 MacBook Pro”

MERK = “Apple MacBook Pro MC721”

HS = 15900000

Case “Apple MC723 MacBook Pro”

MERK = “Apple MacBook Pro MC723”

HS = 19300000

Case “Apple MC724 MacBook Pro”

MERK = “Apple MacBook Pro MC724”

HS = 13700000

Case “Apple MC311 MacBook Pro”

MERK = “Apple MacBook Pro MC311”

HS = 24200000

Case “Apple MC313 MacBook Pro”

MERK = “Apple MacBook Pro MC313”

HS = 11900000

Case “Apple MC314 MacBook Pro”

MERK = “Apple MacBook Pro MC314”

HS = 14700000

Case “Apple MC318 MacBook Pro”

MERK = “Apple MacBook Pro MC318”

HS = 17600000

Case “Apple MC322 MacBook Pro”

MERK = “Apple MacBook Pro MC322”

HS = 21300000

Case “Apple MC965 MacBook Air”

MERK = “Apple MacBook Air MC965”

HS = 12800000

Case “Apple MC966 MacBook Air”

MERK = “Apple MacBook Air MC966”

HS = 15800000

End Select

TxtMERK.Text = MERK

TxtHS.Text = HS

 

End Sub

 

Private Sub ComdEXIT_Click()

Unload Me

End Sub

 

Private Sub ComdLAGI_Click()

CbKODE.SetFocus

CbKODE.Text = “”

TxtMERK.Text = “”

TxtHS.Text = “”

TxtJUAL.Text = “”

TxtPENJU.Text = “”

Txtdisco.Text = “”

TxtTOTAL.Text = “”

End Sub

 

Private Sub ComdPROSES_Click()

TxtPENJU.Text = Val(TxtJUAL.Text) * Val(TxtHS.Text)

If Val(TxtPENJU.Text) > 140000000 Then

Txtdisco.Text = Val(TxtPENJU.Text) * 15 / 100

ElseIf Val(TxtPENJU.Text) > 135000000 Then

Txtdisco.Text = 10 / 100 * Val(TxtPENJU.Text)

ElseIf Val(TxtPENJU.Text) > “130000000” Then

Txtdisco.Text = 5 / 100 * Val(TxtPENJU.Text)

ElseIf Val(TxtPENJU.Text) > “125000000” Then

Txtdisco.Text = 2 / 100 * Val(TxtPENJU.Text)

 

End If

TxtTOTAL.Text = Val(TxtPENJU.Text) – Val(Txtdisco.Text)

 

End Sub

 

Private Sub Command1_Click()

Data1.Recordset.Update

Data1.Recordset.MoveNext

End Sub

 

Private Sub Command2_Click()

Data1.Recordset.AddNew

Data1.Recordset.MoveNext

End Sub

 

Private Sub Command3_Click()

Data1.Recordset.Delete

End Sub

 

Private Sub Form_Load()

CbKODE.AddItem “Apple MC965 MacBook Air”

CbKODE.AddItem “Apple MC966 MacBook Air”

CbKODE.AddItem “Apple MC968 MacBook Air”

CbKODE.AddItem “Apple MC969 MacBook Air”

CbKODE.AddItem “Apple MC700 MacBook Pro”

CbKODE.AddItem “Apple MC721 MacBook Pro”

CbKODE.AddItem “Apple MC723 MacBook Pro”

CbKODE.AddItem “Apple MC724 MacBook Pro”

CbKODE.AddItem “Apple MC311 MacBook Pro”

CbKODE.AddItem “Apple MC313 MacBook Pro”

CbKODE.AddItem “Apple MC314 MacBook Pro”

CbKODE.AddItem “Apple MC318 MacBook Pro”

CbKODE.AddItem “Apple MC322 MacBook Pro”

CbKODE.AddItem “Apple MC965 MacBook Air”

CbKODE.AddItem “Apple MC966 MacBook Air”

End Sub

5. entri penjualan komputer dengan database

DBKE5

Private Sub Combo1_Change()

 

End Sub

 

Private Sub CbKODE_Click()

Dim JK, HS, JJ, HP, DISCO, TOTAL As Variant

Select Case CbKODE.Text

Case “P205”

JK = “Pentium II 500 Mega Hz”

HS = 1500000

Case “P308″

JK = ” Pentium III 800 Mega Hz ”

HS = 2100000

Case “P310”

JK = “Pentium III 1.0 Giga Hz ”

HS = 3500000

Case “P415”

JK = “Pentium IV 1.5 Giga Hz”

HS = 4000000

Case “P417”

JK = “Pentium IV 1.7 Giga Hz ”

HS = 4200000

Case “P419”

JK = “Pentium IV 1.9 Giga Hz”

HS = 5500000

End Select

TxtJK.Text = JK

TxtHS.Text = HS

TxtJJ.SetFocus

 

End Sub

 

Private Sub ComdEXIT_Click()

Unload Me

End Sub

 

Private Sub ComdLAGI_Click()

CbKODE.SetFocus

CbKODE.Text = “”

TxtJK.Text = “”

TxtHS.Text = “”

TxtJJ.Text = “”

TxtHP.Text = “”

TxtDISCO.Text = “”

TxtTOTAL.Text = “”

 

End Sub

 

Private Sub ComdPROSES_Click()

TxtHP.Text = Val(TxtHS) * Val(TxtJJ.Text)

If Val(TxtHP.Text) > 30000000 Then

TxtDISCO.Text = Val(TxtHP.Text) * 15 / 100

ElseIf Val(TxtHP.Text) > 25000000 Then

TxtDISCO.Text = 10 / 100 * Val(TxtHP.Text)

ElseIf Val(TxtHP.Text) > “20000000” Then

TxtDISCO.Text = 5 / 100 * Val(TxtHP.Text)

ElseIf Val(TxtHP.Text) > “15000000” Then

TxtDISCO.Text = 2 / 100 * Val(TxtHP.Text)

End If

TxtTOTAL.Text = Val(TxtHP.Text) – Val(TxtDISCO)

 

End Sub

 

Private Sub Command1_Click()

Data1.Recordset.Update

End Sub

 

Private Sub Command2_Click()

Data1.Recordset.AddNew

End Sub

 

Private Sub Command3_Click()

Data1.Recordset.Delete

End Sub

 

Private Sub Form_Load()

CbKODE.AddItem “P205”

CbKODE.AddItem “P308”

CbKODE.AddItem “P310”

CbKODE.AddItem “P415”

CbKODE.AddItem “P417”

CbKODE.AddItem “P419”

End Sub

selamat mencoba kawan!

 

 

Pengujian logika fungsi left mid right pada textbox vb.6

Tugas 4 program penjualan tiket KA

image

Private Sub ComdKELUAR_Click()
Unload Me
End Sub

Private Sub ComdLAGI_Click()
TextKODE.SetFocus
TextKODE.Text = “”
TextHARGA.Text = “”
TextJK.Text = “”
TextJB.Text = “”
TextJT.Text = “”
TextTOTAL.Text = “”
End Sub

Private Sub ComdPROSES_Click()
Dim harga, A, jk, jb, jt As Variant
A = Left(TextKODE.Text, 3)
If A = “BIM” Then
TextHARGA.Text = “50000”
TextJK = “BIMA”
TextJB.Text = “16:00”
ElseIf A = “EKO” Then
TextHARGA.Text = “35000”
TextJK = “EKONOMI”
TextJB.Text = “19:00”
ElseIf A = “MUT” Then
TextHARGA.Text = “23000”
TextJK = “MUTIARA”
TextJB.Text = “17:00”
ElseIf A = “SEN” Then
TextHARGA.Text = “15000”
TextJK = “SENJA”
TextJB.Text = “20:00”
End If
TextJT.SetFocus
End Sub

Private Sub TextJT_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TextTOTAL.Text = Val(TextJT) * Val(TextHARGA)
End If
End Sub

Tugas 5
Data buku textbox

image

Private Sub ComdKELUAR_Click()
Unload Me
End Sub

Private Sub ComdLAGI_Click()
TextKODE.SetFocus
TextKODE.Text = “”
TextHARGA.Text = “”
TextpENG.Text = “”
Textpene.Text = “”
TextTT.Text = “”
TextJB.Text = “”
End Sub

Private Sub ComdPROSES_Click()
Dim A As String
A = Left(TextKODE.Text, 3)
If A = “SIM” Then
TextJB.Text = “Sistem Informasi Manajemen”
TextpENG.Text = “Fadiya Ulfa”
TextHARGA.Text = “75900”
ElseIf A = “EDP” Then
TextJB.Text = “Elektronik Data Processing”
TextpENG.Text = “Nurul Agustinaa”
TextHARGA.Text = “62000”
ElseIf A = “MNJ” Then
TextJB.Text = “Manajemen”
TextpENG.Text = “Rian Hidayat”
TextHARGA.Text = “82000”
ElseIf A = “CDR” Then
TextJB.Text = “Corel Draw”
TextpENG.Text = “Siti Nur Khotimah”
TextHARGA.Text = “53000”
ElseIf A = “RPL” Then
TextJB.Text = “Rekayasa Perangkat Lunak”
TextpENG.Text = “Winda Erlianti”
TextHARGA.Text = “83000”
End If

image

M = Right(TextKODE.Text, 1)
If M = “A” Then
Textpene.Text = “Andi Offset Yogyakarta”””
ElseIf M = “I” Then
Textpene.Text = “Indah Surabaya”
ElseIf M = “S” Then
Textpene.Text = “Salemba Empat”
ElseIf M = “E” Then
Textpene.Text = “Elek Media Komputindo”
ElseIf M = “M” Then
Textpene.Text = “Maxicom”
End If
TextTT.Text = “20” & Mid(TextKODE.Text, 5, 2)
End Sub
Tugas 6 data karyawan

image

Private Sub ComdBATAL_Click()
TextNAMA.SetFocus
TextNAMA.Text = “”
TextNIK.Text = “”
TextGOL.Text = “”
TextKODE.Text = “”
TextSTAT.Text = “”
TextTAHU.Text = “”
TextJABA.Text = “”
TextBAGI.Text = “”
TextGAPOK.Text = “”
TextTUNJA.Text = “”
TextTOTAL.Text = “”
End Sub

Private Sub ComdKELUAR_Click()
Unload Me
End Sub

Private Sub ComdLAGI_Click()
TextNAMA.SetFocus
TextNAMA.Text = “”
TextNIK.Text = “”
TextGOL.Text = “”
TextKODE.Text = “”
TextSTAT.Text = “”
TextTAHU.Text = “”
TextJABA.Text = “”
TextBAGI.Text = “”
TextGAPOK.Text = “”
TextTUNJA.Text = “”
TextTOTAL.Text = “”
End Sub

Private Sub ComdPROSES_Click()
Dim GOL, KODE, GAPOK, TOTAL, Y, TUNJA As Variant
TextTAHU.Text = Left(TextNIK.Text, 4)
Y = Mid(TextNIK.Text, 5, 1)
If Y = “A” Then
TextGOL.Text = “A”
TextJABA.Text = “MANAJER”
TextGAPOK.Text = “4000000”
TextTUNJA.Text = “1025000”
ElseIf Y = “B” Then
TextGOL.Text = “B”
TextJABA.Text = “KA.SEKSI”
TextGAPOK.Text = “3500000”
TextTUNJA.Text = “975000”
ElseIf Y = “C” Then
TextGOL.Text = “C”
TextJABA.Text = “STAFF”
TextTUNJA.Text = “925000”
TextGAPOK.Text = “3000000”
End If
Y = Right(TextNIK.Text, 3)
If Y = “ADM” Then
TextBAGI.Text = “Administrasi”
ElseIf Y = “KEU” Then
TextBAGI.Text = “Accounting”
ElseIf Y = “SDM” Then
TextBAGI.Text = “General Affair”
ElseIf Y = “EDP” Then
TextBAGI.Text = “IT Unit”
ElseIf Y = “SPM” Then
TextBAGI.Text = “Security”
End If
Y = Mid(TextNIK.Text, 7, 1)
If Y = “S” Then
TextKODE.Text = “S”
TextSTAT.Text = “Single”
ElseIf Y = “M” Then
TextKODE.Text = “M”
TextSTAT.Text = “Menikah”
ElseIf Y = “J” Then
TextKODE.Text = “”
TextSTAT.Text = “Janda”
ElseIf Y = “D” Then
TextKODE.Text = “D”
TextSTAT.Text = “Duda”
End If
TextTOTAL.Text = Val(TextGAPOK) + Val(TextTUNJA)

End Sub

image

Private Sub TextNAMA_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TextNIK.SetFocus
End If
End Sub

Program Visual basic inputan kode pada combobox

01- Aplikasi penetapan gaji /golongan karyawan.

image

Private Sub Cbgolongan_load()
cbogolongan.AddItem “I”
cbogolongan.AddItem “II”
cbogolongan.AddItem “III”
cbogolongan.AddItem “IV”

End Sub

Private Sub Cbgolongan_Click()
Dim gapok, pajak, tunjangan, total As Variant
Select Case Cbgolongan.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 Else
gapok = 0
tunjangan = 0
End Select
total = gapok + tunjangan
pajak = total * 0.1
TxtGAPOK.Text = gapok
TxtTUNJA.Text = tunjangan
TxtPAJAK.Text = pajak
TxtTOTAL.Text = total – pajak
End Sub

Private Sub Command3_Click()
Unload Me
End Sub

Private Sub ComdBATAL_Click()
kosong
End Sub
Public Sub kosong()
TxtNIDN.SetFocus
TxtNIDN.Text = “”
TxtNAMA.Text = “”
Cbgolongan.Text = “”
TxtGAPOK.Text = “”
TxtTUNJA.Text = “”
TxtPAJAK.Text = “”
TxtTOTAL.Text = “”
End Sub
Private Sub ComDKELUAR_Click()
Unload Me
End Sub

Private Sub ComdLAGI_Click()
kosong
End Sub

Private Sub Form_Load()
Cbgolongan.AddItem “I”
Cbgolongan.AddItem “II”
Cbgolongan.AddItem “III”
Cbgolongan.AddItem “IV”

End Sub

Private Sub Text1_Change()

End Sub

Private Sub TxtNIDN_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TxtNAMA.SetFocus
End If

End Sub
02- Untuk NPM 3 digit.

image

15100045
Private Sub Cmdbatal_Click()
txtnama.SetFocus
txtnama.Text = “”
txtnpm.Text = “”
Txtjur.Text = “”
Txtps.Text = “”
TxtTM.Text = “”
Txturut.Text = “”
End Sub

Private Sub Cmdexit_Click()
Unload Me
End Sub

Private Sub Cmdproses_Click()
Dim S As String
TxtTM.Text = “20” & Left(txtnpm.Text, 2)
S = Mid(txtnpm.Text, 3, 1)
If S = “1” Then
Txtjur.Text = “Sistem Informasi”
Txtps.Text = “Strata Satu”
ElseIf S = “2” Then
Txtjur.Text = “Manajemen Informatika”
Txtps.Text = “Diploma Tiga”
ElseIf S = “3” Then
Txtjur.Text = “Tehnik Informatika”
Txtps.Text = “Diploma Empat”
ElseIf S = “4” Then
Txtjur.Text = “Manajemen & Komp. Akuntansi”
Txtps.Text = “Diploma Dua”
End If
S = Mid(txtnpm.Text, 4, 2)

Txturut.Text = Right(txtnpm.Text, 2)

End Sub

Private Sub Cmdulang_Click()
txtnama.SetFocus
txtnama.Text = “”
txtnpm.Text = “”
Txtjur.Text = “”
Txtps.Text = “”
TxtTM.Text = “”
Txturut.Text = “”
End Sub

Private Sub Form_activate()
txtnama.SetFocus
txtnama.Text = “”
txtnpm.Text = “”
Txtjur.Text = “”
Txtps.Text = “”
TxtTM.Text = “”
Txturut.Text = “”
End Sub

Private Sub txtnama_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then
txtnpm.SetFocus
End If

End Sub
03- Untuk NPM 4 digit lebih.

image

11102956
Private Sub Cmdproses_Click()
Dim S As String
TxtTm.Text = “20” & Left(Txtnpm.Text, 2)
S = Mid(Txtnpm.Text, 3, 1)
If S = “1” Then
Txtjur.Text = “Sistem Informasi”
ElseIf S = “2” Then
Txtjur.Text = “Manajemen Informatika”
ElseIf S = “3” Then
Txtjur.Text = “Tehnik Informatika”
ElseIf S = “4” Then
Txtjur.Text = “Manajemen & Komp. Akuntansi”
End If
S = Mid(Txtnpm.Text, 4, 2)
If S = “01” Then
Txtps.Text = “Strata Satu”
ElseIf S = “02” Then
Txtps.Text = “Diploma Tiga”
ElseIf S = “03” Then
Txtps.Text = “Diploma Empat”
ElseIf S = “04” Then
Txtps.Text = “Diploma Dua”
End If
Txturut.Text = Right(Txtnpm.Text, 3)
End Sub
Private Sub txtnama_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then
txtnpm.SetFocus
End If
End sub
Private Sub Form_activate()
txtnama.SetFocus
txtnama.Text = “”
txtnpm.Text = “”
Txtjur.Text = “”
Txtps.Text = “”
TxtTM.Text = “”
Txturut.Text = “”
End Sub
Private Sub Cmdbatal_Click()
txtnama.SetFocus
txtnama.Text = “”
txtnpm.Text = “”
Txtjur.Text = “”
Txtps.Text = “”
TxtTM.Text = “”
Txturut.Text = “”
End Sub

Private Sub Cmdexit_Click()
Unload Me
End Sub

Contoh penerapan program select case &fungsi left,mid,right Visual basic

Tugas-1 Tabel penjaulan LAptop

image

Private Sub Combo1_Change()

End Sub

Private Sub CbKODE_Click()
Dim MERK, HS As Variant
Select Case CbKODE.Text
Case “MC965”
MERK = “Apple MacBook Air MC965”
HS = 12800000
Case “MC966”
MERK = “Apple MacBook Air MC966”
HS = 15800000
Case “MC968”
MERK = “Apple MacBook Air MC968”
HS = 9900000
Case “MC969”
MERK = “Apple MacBook Air MC969”
HS = 11900000
Case “MC700”
MERK = “Apple MacBook Pro MC700”
HS = 10800000
Case “MC721”
MERK = “Apple MacBook Pro MC721”
HS = 15900000
Case “MC723”
MERK = “Apple MacBook Pro MC723”
HS = 19300000
Case “MC724”
MERK = “Apple MacBook Pro MC724”
HS = 13700000
Case “MC311”
MERK = “Apple MacBook Pro MC311”
HS = 24200000
Case “MC313”
MERK = “Apple MacBook Pro MC313”
HS = 11900000
Case “MC314”
MERK = “Apple MacBook Pro MC314”
HS = 14700000
Case “MC318”
MERK = “Apple MacBook Pro MC318”
HS = 17600000
Case “MC322”
MERK = “Apple MacBook Pro MC322”
HS = 21300000
Case “MC965”
MERK = “Apple MacBook Air MC965”
HS = 12800000
Case “MC966”
MERK = “Apple MacBook Air MC966”
HS = 15800000

End Select
TxtJUAL.SetFocus
TxtMERK.Text = MERK
TxtHS.Text = HS

End Sub

image

Private Sub ComdEXIT_Click()
Unload Me
End Sub

Private Sub ComdLAGI_Click()
CbKODE.SetFocus
CbKODE.Text = “”
TxtMERK.Text = “”
TxtHS.Text = “”
TxtJUAL.Text = “”
TxtPENJU.Text = “”
Txtdisco.Text = “”
TxtTOTAL.Text = “”
End Sub

Private Sub ComdPROSES_Click()
TxtPENJU.Text = Val(TxtJUAL.Text) * Val(TxtHS.Text)
If Val(TxtPENJU.Text) > 140000000 Then
Txtdisco.Text = Val(TxtPENJU.Text) * 15 / 100
ElseIf Val(TxtPENJU.Text) > 135000000 Then
Txtdisco.Text = 10 / 100 * Val(TxtPENJU.Text)
ElseIf Val(TxtPENJU.Text) > “130000000” Then
Txtdisco.Text = 5 / 100 * Val(TxtPENJU.Text)
ElseIf Val(TxtPENJU.Text) > “125000000” Then
Txtdisco.Text = 2 / 100 * Val(TxtPENJU.Text)

End If
TxtTOTAL.Text = Val(TxtPENJU.Text) – Val(Txtdisco.Text)
End Sub
Private Sub Form_Load()
CbKODE.AddItem “MC965”
CbKODE.AddItem “MC966”
CbKODE.AddItem “MC968”
CbKODE.AddItem “MC969”
CbKODE.AddItem “MC700”
CbKODE.AddItem “MC721”
CbKODE.AddItem “MC723”
CbKODE.AddItem “MC724”
CbKODE.AddItem “MC311”
CbKODE.AddItem “MC313”
CbKODE.AddItem “MC314”
CbKODE.AddItem “MC318”
CbKODE.AddItem “MC322”
CbKODE.AddItem “MC965”
CbKODE.AddItem “MC966”
End Sub

TUgas 2 Tabel penjualan mesin komputer

image

Private Sub Combo1_Change()

End Sub

Private Sub CbKODE_Click()
Dim JK, HS, JJ, HP, DISCO, TOTAL As Variant
Select Case CbKODE.Text
Case “P205”
JK = “Pentium II  500 Mega Hz”
HS = 1500000
Case “P308″
JK = ” Pentium III  800 Mega Hz ”
HS = 2100000
Case “P310”
JK = “Pentium III 1.0 Giga Hz ”
HS = 3500000
Case “P415”
JK = “Pentium IV  1.5 Giga Hz”
HS = 4000000
Case “P417”
JK = “Pentium IV  1.7 Giga Hz ”
HS = 4200000
Case “P419”
JK = “Pentium IV  1.9 Giga Hz”
HS = 5500000
End Select
TxtJK.Text = JK
TxtHS.Text = HS
TxtJJ.SetFocus

End Sub

Private Sub ComdEXIT_Click()
Unload Me
End Sub

Private Sub ComdLAGI_Click()
CbKODE.SetFocus
CbKODE.Text = “”
TxtJK.Text = “”
TxtHS.Text = “”
TxtJJ.Text = “”
TxtHP.Text = “”
TxtDISCO.Text = “”
TxtTOTAL.Text = “”

End Sub

Private Sub ComdPROSES_Click()
TxtHP.Text = Val(TxtHS) * Val(TxtJJ.Text)
If Val(TxtHP.Text) > 30000000 Then
TxtDISCO.Text = Val(TxtHP.Text) * 15 / 100
ElseIf Val(TxtHP.Text) > 25000000 Then
TxtDISCO.Text = 10 / 100 * Val(TxtHP.Text)
ElseIf Val(TxtHP.Text) > “20000000” Then
TxtDISCO.Text = 5 / 100 * Val(TxtHP.Text)
ElseIf Val(TxtHP.Text) > “15000000” Then
TxtDISCO.Text = 2 / 100 * Val(TxtHP.Text)
End If
TxtTOTAL.Text = Val(TxtHP.Text) – Val(TxtDISCO)

End Sub

Private Sub Form_Load()
CbKODE.AddItem “P205”
CbKODE.AddItem “P308”
CbKODE.AddItem “P310”
CbKODE.AddItem “P415”
CbKODE.AddItem “P417”
CbKODE.AddItem “P419”
End Sub
Tugas 3. Data buku

image

Private Sub ComdBATAL_Click()
Cbkode.SetFocus
Cbkode.Text = “”
Textjudul.Text = “”
Textpeng.Text = “”
TextTT.Text = “”
Textpene.Text = “”
Textharga.Text = “”
End Sub

Private Sub ComdKELUAR_Click()
Unload Me
End Sub

Private Sub ComdLAGI_Click()
Cbkode.SetFocus
Cbkode.Text = “”
Textjudul.Text = “”
Textpeng.Text = “”
TextTT.Text = “”
Textpene.Text = “”
Textharga.Text = “”
End Sub

Private Sub ComdPROSES_Click()
Dim judul, pengarang, harga As String
Y = Mid(Cbkode.Text, 3, 3)
If Y = “SIM” Then
Textjudul.Text = “Sistem Informasi Manajeme”
Textpeng.Text = “Yati Nur Oktavia”
Textharga.Text = “75900”
ElseIf Y = “EDP” Then
Textjudul.Text = “Elektronik Data Processing”
Textpeng.Text = “Imam Tarmizi”
Textharga.Text = “62000”
ElseIf Y = “CDR” Then
Textjudul.Text = “Corel Draw”
Textpeng.Text = “Riyan Suhandi”
Textharga.Text = “53000”
ElseIf Y = “MNJ” Then
Textjudul.Text = “Manajemen”
Textpeng.Text = “Valentina Mariana Adiwianti”
Textharga.Text = “42000”
ElseIf Y = “RPL” Then
Textjudul.Text = “Rekayasa Perangkat Lunak”
Textpeng.Text = “Sinta Umpu Singa”
Textharga.Text = “83000”
End If
TextTT.Text = “20” & Right(Cbkode.Text, 2)
Dim S As String
S = Left(Cbkode.Text, 1)
If S = “A” Then
Textpene.Text = “Andi Offset Yogyakarta”
ElseIf S = “I” Then
Textpene.Text = “Indah Surabaya”
ElseIf S = “S” Then
Textpene.Text = “Salemba Empat”
ElseIf S = “M” Then
Textpene.Text = “Maxicom”
ElseIf S = “E” Then
Textpene.Text = “Elek Media Komputindo”

End If

End Sub

Private Sub Form_Load()
Cbkode.AddItem “A-SIM-01”
Cbkode.AddItem “I -EDP -02”
Cbkode.AddItem “S -MNJ – 03”
Cbkode.AddItem “E -CDR – 04”
Cbkode.AddItem “M -RPL – 05”

End Sub

Contoh penerapan proram select case &fungsi left,mid,right Visual basic

Tugas-1
Tabel penjaulan LAptop

image

Private Sub Combo1_Change()

End Sub

Private Sub CbKODE_Click()
Dim MERK, HS As Variant
Select Case CbKODE.Text
Case “MC965”
MERK = “Apple MacBook Air MC965”
HS = 12800000
Case “MC966”
MERK = “Apple MacBook Air MC966”
HS = 15800000
Case “MC968”
MERK = “Apple MacBook Air MC968”
HS = 9900000
Case “MC969”
MERK = “Apple MacBook Air MC969”
HS = 11900000
Case “MC700”
MERK = “Apple MacBook Pro MC700”
HS = 10800000
Case “MC721”
MERK = “Apple MacBook Pro MC721”
HS = 15900000
Case “MC723”
MERK = “Apple MacBook Pro MC723”
HS = 19300000
Case “MC724”
MERK = “Apple MacBook Pro MC724”
HS = 13700000
Case “MC311”
MERK = “Apple MacBook Pro MC311”
HS = 24200000
Case “MC313”
MERK = “Apple MacBook Pro MC313”
HS = 11900000
Case “MC314”
MERK = “Apple MacBook Pro MC314”
HS = 14700000
Case “MC318”
MERK = “Apple MacBook Pro MC318”
HS = 17600000
Case “MC322”
MERK = “Apple MacBook Pro MC322”
HS = 21300000
Case “MC965”
MERK = “Apple MacBook Air MC965”
HS = 12800000
Case “MC966”
MERK = “Apple MacBook Air MC966”
HS = 15800000

End Select
TxtJUAL.SetFocus
TxtMERK.Text = MERK
TxtHS.Text = HS

End Sub

image

Private Sub ComdEXIT_Click()
Unload Me
End Sub

Private Sub ComdLAGI_Click()
CbKODE.SetFocus
CbKODE.Text = “”
TxtMERK.Text = “”
TxtHS.Text = “”
TxtJUAL.Text = “”
TxtPENJU.Text = “”
Txtdisco.Text = “”
TxtTOTAL.Text = “”
End Sub

Private Sub ComdPROSES_Click()
TxtPENJU.Text = Val(TxtJUAL.Text) * Val(TxtHS.Text)
If Val(TxtPENJU.Text) > 140000000 Then
Txtdisco.Text = Val(TxtPENJU.Text) * 15 / 100
ElseIf Val(TxtPENJU.Text) > 135000000 Then
Txtdisco.Text = 10 / 100 * Val(TxtPENJU.Text)
ElseIf Val(TxtPENJU.Text) > “130000000” Then
Txtdisco.Text = 5 / 100 * Val(TxtPENJU.Text)
ElseIf Val(TxtPENJU.Text) > “125000000” Then
Txtdisco.Text = 2 / 100 * Val(TxtPENJU.Text)

End If
TxtTOTAL.Text = Val(TxtPENJU.Text) – Val(Txtdisco.Text)
End Sub
Private Sub Form_Load()
CbKODE.AddItem “MC965”
CbKODE.AddItem “MC966”
CbKODE.AddItem “MC968”
CbKODE.AddItem “MC969”
CbKODE.AddItem “MC700”
CbKODE.AddItem “MC721”
CbKODE.AddItem “MC723”
CbKODE.AddItem “MC724”
CbKODE.AddItem “MC311”
CbKODE.AddItem “MC313”
CbKODE.AddItem “MC314”
CbKODE.AddItem “MC318”
CbKODE.AddItem “MC322”
CbKODE.AddItem “MC965”
CbKODE.AddItem “MC966”
End Sub

TUgas 2
Tabel penjualan mesin komputer

image

Private Sub Combo1_Change()

End Sub

Private Sub CbKODE_Click()
Dim JK, HS, JJ, HP, DISCO, TOTAL As Variant
Select Case CbKODE.Text
Case “P205”
JK = “Pentium II  500 Mega Hz”
HS = 1500000
Case “P308″
JK = ” Pentium III  800 Mega Hz ”
HS = 2100000
Case “P310”
JK = “Pentium III 1.0 Giga Hz ”
HS = 3500000
Case “P415”
JK = “Pentium IV  1.5 Giga Hz”
HS = 4000000
Case “P417”
JK = “Pentium IV  1.7 Giga Hz ”
HS = 4200000
Case “P419”
JK = “Pentium IV  1.9 Giga Hz”
HS = 5500000
End Select
TxtJK.Text = JK
TxtHS.Text = HS
TxtJJ.SetFocus

End Sub

Private Sub ComdEXIT_Click()
Unload Me
End Sub

Private Sub ComdLAGI_Click()
CbKODE.SetFocus
CbKODE.Text = “”
TxtJK.Text = “”
TxtHS.Text = “”
TxtJJ.Text = “”
TxtHP.Text = “”
TxtDISCO.Text = “”
TxtTOTAL.Text = “”

End Sub

Private Sub ComdPROSES_Click()
TxtHP.Text = Val(TxtHS) * Val(TxtJJ.Text)
If Val(TxtHP.Text) > 30000000 Then
TxtDISCO.Text = Val(TxtHP.Text) * 15 / 100
ElseIf Val(TxtHP.Text) > 25000000 Then
TxtDISCO.Text = 10 / 100 * Val(TxtHP.Text)
ElseIf Val(TxtHP.Text) > “20000000” Then
TxtDISCO.Text = 5 / 100 * Val(TxtHP.Text)
ElseIf Val(TxtHP.Text) > “15000000” Then
TxtDISCO.Text = 2 / 100 * Val(TxtHP.Text)
End If
TxtTOTAL.Text = Val(TxtHP.Text) – Val(TxtDISCO)

End Sub

Private Sub Form_Load()
CbKODE.AddItem “P205”
CbKODE.AddItem “P308”
CbKODE.AddItem “P310”
CbKODE.AddItem “P415”
CbKODE.AddItem “P417”
CbKODE.AddItem “P419”
End Sub
Tugas 3.
Data buku

image

Private Sub ComdBATAL_Click()
Cbkode.SetFocus
Cbkode.Text = “”
Textjudul.Text = “”
Textpeng.Text = “”
TextTT.Text = “”
Textpene.Text = “”
Textharga.Text = “”
End Sub

Private Sub ComdKELUAR_Click()
Unload Me
End Sub

Private Sub ComdLAGI_Click()
Cbkode.SetFocus
Cbkode.Text = “”
Textjudul.Text = “”
Textpeng.Text = “”
TextTT.Text = “”
Textpene.Text = “”
Textharga.Text = “”
End Sub

Private Sub ComdPROSES_Click()
Dim judul, pengarang, harga As String
Y = Mid(Cbkode.Text, 3, 3)
If Y = “SIM” Then
Textjudul.Text = “Sistem Informasi Manajeme”
Textpeng.Text = “Yati Nur Oktavia”
Textharga.Text = “75900”
ElseIf Y = “EDP” Then
Textjudul.Text = “Elektronik Data Processing”
Textpeng.Text = “Imam Tarmizi”
Textharga.Text = “62000”
ElseIf Y = “CDR” Then
Textjudul.Text = “Corel Draw”
Textpeng.Text = “Riyan Suhandi”
Textharga.Text = “53000”
ElseIf Y = “MNJ” Then
Textjudul.Text = “Manajemen”
Textpeng.Text = “Valentina Mariana Adiwianti”
Textharga.Text = “42000”
ElseIf Y = “RPL” Then
Textjudul.Text = “Rekayasa Perangkat Lunak”
Textpeng.Text = “Sinta Umpu Singa”
Textharga.Text = “83000”
End If
TextTT.Text = “20” & Right(Cbkode.Text, 2)
Dim S As String
S = Left(Cbkode.Text, 1)
If S = “A” Then
Textpene.Text = “Andi Offset Yogyakarta”
ElseIf S = “I” Then
Textpene.Text = “Indah Surabaya”
ElseIf S = “S” Then
Textpene.Text = “Salemba Empat”
ElseIf S = “M” Then
Textpene.Text = “Maxicom”
ElseIf S = “E” Then
Textpene.Text = “Elek Media Komputindo”

End If

End Sub

Private Sub Form_Load()
Cbkode.AddItem “A-SIM-01”
Cbkode.AddItem “I -EDP -02”
Cbkode.AddItem “S -MNJ – 03”
Cbkode.AddItem “E -CDR – 04”
Cbkode.AddItem “M -RPL – 05”

End Sub

Option style font & color vb.6

Awal nya anda harus buat desain program seperti ini

image

Dengan 2 buah label, 2 command button, 1 textbox & 1 frame memiliki isi 4 checkbox untuk style font & 4 optionbox untuk color style.,
Setelah itu masukan codinya seperti ini:

. Private Sub Comdselesai_Click()
Unload Me
End Sub

Private Sub Option1_Click()
Label2.ForeColor = vbRed
End Sub

Private Sub Option2_Click()
Label2.ForeColor = vbBlue
End Sub

Private Sub Option3_Click()
Label2.ForeColor = vbGreen
End Sub

Private Sub Option4_Click()
Label2.ForeColor = vbYellow
End Sub
Private Sub Check1_Click()
Label2.FontBold = True
End Sub

Private Sub Check2_Click()
Label2.FontItalic = True
End Sub

Private Sub Check3_Click()
Label2.FontUnderline = True
End Sub

Private Sub Check4_Click()
Label2.FontStrikethru = True
End Sub

Private Sub ComdOK_Click()
Label2.Caption = Text1.Text
End Sub .

Run program nya:

image

Selamat mencoba✌

Aplikasi penghitung & penentu huruf mutu vb.6

Langhkah awal dengan membuat desain program nya

image

Dengan susunan 10 label,9 textbox,1 combobox & 3 command button.., disusun dengan sedemikian rupa, lalu masukan coding:
Langkah 1. Private Sub Form_Load()
Cbonpm.AddItem “15100107”
Cbonpm.AddItem “15100048”
Cbonpm.AddItem “15100045”
Cbonpm.AddItem “15100052”
Cbonpm.AddItem “15100043”
Cbonpm.AddItem “15100044”
Cbonpm.AddItem “15100054”
Cbonpm.AddItem “15100056”
Cbonpm.AddItem “15100063”
Cbonpm.AddItem “15100081”
Cbonpm.AddItem “15100046”
Cbonpm.AddItem “15100217”
Cbonpm.AddItem “15100053”
Cbonpm.AddItem “15100073”
Cbonpm.AddItem “15100082”
Cbonpm.AddItem “15100076”
Cbonpm.AddItem “15100057”
Cbonpm.AddItem “15100044”
Cbonpm.AddItem “15100067”
Cbonpm.AddItem “15100066”
Cbonpm.AddItem “15100047”
Cbonpm.AddItem “15100048”
Cbonpm.AddItem “15100050”
Cbonpm.AddItem “15100051”
Cbonpm.AddItem “15100074”
Cbonpm.AddItem “15100062”
Cbonpm.AddItem “15100070”
Cbonpm.AddItem “15100071”
Cbonpm.AddItem “15100080”
Cbonpm.AddItem “15100068”
Cbonpm.AddItem “15100064”
Cbonpm.AddItem “15100079”
Cbonpm.AddItem “15100061”
Cbonpm.AddItem “15100059”
Cbonpm.AddItem “15100072”
Cbonpm.AddItem “15100069”
Cbonpm.AddItem “15100055”
Cbonpm.AddItem “15100075”

Cbonpm.AddItem “15100045”
End sub

Langkah 2 untuk memanggil nama mahasiswa sesuai npm & jurusanya denga coding:
Private Sub Cbonpm_Click()
Dim nama, jurusan, HM As String

Select Case Cbonpm.Text
Case “15100045”
nama = “GILBERT ALEXANDER BAGUS.S”
jurusan = “Sistem Informasi”
Case “15100057”
nama = “HAFID BANU RAHMAN”
jurusan = “Manajemen Informatika”
Case “15100043”
nama = “BENI RISMAWAN”
jurusan = “Tehnik Informatika”
Case “15100047”
nama = “M.MANDALA SAKTI”
jurusan = “Sistem Informasi”
Case “15100052”
nama = “ADITYA WIBOWO”
jurusan = “Sistem Informasi”
Case “15100107”
nama = “ADI KISWANTO”
jurusan = “Tehnik Informatika”
Case “15100054”
nama = “AGUNG SETIAWAN”
jurusan = “Manajemen Informatika”
Case “15100056”
nama = “ALFINA DAMAYANTI”
jurusan = “Manajemen Informatika”
Case “15100063”
nama = “ANTI SUSANTI”
jurusan = “Manajemen Informatika”
Case “15100081”
nama = “ANTIA”
jurusan = “Tehnik Informatika”
Case “15100046”
nama = “BAYU SANJAYA”
jurusan = “Komputer Akuntansi”
Case “15100217”
nama = “CATUR PUJI PAMUNGKAS”
jurusan = “sistem pemrograman”
Case “15100053”
nama = “DAVID BUDIANTO”
jurusan = “Tehnik Informatika”
Case “15100058”
nama = “DERU HENDRAWAN”
jurusan = “Komputer Grafika”
Case “15100073”
nama = “ELMA SINTIA”
jurusan = “komputer akuntansi”
Case “15100082”
nama = “ENI SUNDARI”
jurusan = “Sistem Komunikasi”
Case “15100056”
nama = “GITA KUSUMAWARDANI”
jurusan = “Sistem Informasi”
Case “15100044”
nama = “IRFAN NUR FADULLOH”
jurusan = “Sistem Informasi”
Case “15100066”
nama = “LELA KOMALA SARI”
jurusan = “Manajemen Informatika”
Case “15100067”
nama = “LAILA TURROHMAH”
jurusan = “Komputer Akuntansi”
Case “15100047”
nama = “M.MANDALA SAKTI”
jurusan = “Sistem Informasi”
Case “15100048”
nama = “M.ZAINUL MUTAQIN”
jurusan = “manajemen komputer”
Case “15100050”
nama = “MARIKUN”
jurusan = “Komputer grafis”
Case “15100051”
nama = “MARSYANTO”
jurusan = “Manajemn Komputer”
Case “15100074”
nama = “MUALLAMAH”
jurusan = “Komputer Akuntansi”
Case “15100074”
nama = “NABILA GHASSANI KARLUS”
jurusan = “Manajemen Informatika”
Case “15100070”
nama = “NILA RESTIANA”
jurusan = “Komputer Akuntansi”
Case “15100071”
nama = “NITA MEY LINDA”
jurusan = “Komputer Akuntansi”
Case “15100080”
nama = “NOFIANTI”
jurusan = “Manajemen Informatika”
Case “15100068”
nama = “OKTA MAHENDRA”
jurusan = “Sistem Informasi”
Case “15100064”
nama = “PANCA LARASAFITRI”
jurusan = “Sistem Informasi”
Case “15100079”
nama = “RISKA DIANA”
jurusan = “Manajemen Informatika”
Case “15100061”
nama = “RISWAN EFENDI”
jurusan = “Sistem Informasi”
Case “15100059”
nama = “RIYAN ALFARIZI”
jurusan = “Sistem Informasi”
Case “15100072”
nama = “SUSANTI”
jurusan = “Tehnik Informatika”
Case “15100069”
nama = “TRI AYU SEPTIANA”
jurusan = “manajemen Informatika”
Case “15100055”
nama = “VIVI NASIHATUN”
jurusan = “Sistem Informasi”
Case “15100075”
nama = “WAHYUZA FRISTA DEA”
jurusan = “Manajemen Informatika”
End Select
TXTNAMA.Text = nama
TXTjurusan.Text = jurusan
TXTQUIS.SetFocus
End Sub
.

image

Langkah 3 untuk memasukan nilai tugas dan ujian dengan fungsi enter:
Private Sub TXTQUIS_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TXTTUGAS.SetFocus
End If
End Sub

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

Private Sub TXTUAS_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TXTNA.SetFocus
End If
End Sub

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

Langkah 4 untuk command button proses
Private Sub Comdproses_Click()
Dim NA As Integer
Dim HM As String
QUIS = Val(TXTQUIS.Text)
TUGAS = Val(TXTTUGAS.Text)
UTS = Val(TXTUTS.Text)
UAS = Val(TXTUAS.Text)
NA = Val(QUIS + TUGAS + UTS + UAS) / 4
TXTNA.Text = NA

Select Case TXTNA.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
TEXTHM.Text = HM
End Sub
Langkah 5 untuk command button batal & keluar:

Private Sub Comdbatal_Click()
Cbonpm.SetFocus
Cbonpm.Text = “”
TXTNAMA.Text = “”
TXTjurusan.Text = “”
TXTQUIS.Text = “”
TXTTUGAS.Text = “”
TXTUTS = “”
TXTUAS = “”
TXTNA = “”
TEXTHM = “”

End Sub

Private Sub ComDkeluar_Click()
Unload Me
End Sub

image

Hasilnya seperti ini
Selamat mencoba👍

Font color & font style vb.6

image

Langkah awal untuk membuat desain nya dengan 1label, 2 frame 1 untuk font color & 1 untuk font style setiap frame memiliki 4 option button warna & 4 checkbox font style.,
Masukan coding sesuai tutorial berikut ini:

1.
Private Sub Chkstrikeout_Click()
‘Membuat teks dicoret’
If Chkstrikeout.Value = 1 Then
    Lblteks.FontStrikethru = True
Else
    Lblteks.FontStrikethru = False
End If
End Sub

Private Sub Chkitalic_Click()
‘Membuat teks miring’
If Chkitalic.Value = 1 Then
    Lblteks.FontItalic = True
Else
    Lblteks.FontItalic = False
End If

End Sub

Private Sub Chkbold_Click()
‘Membuat teks Tebal’
If Chkbold.Value = 1 Then
    Lblteks.FontBold = True
Else
    Lblteks.FontBold = False
End If

End Sub

Private Sub Chkunderline_Click()
‘Membuat teks garis bawah’
If Chkunderline.Value = 1 Then
    Lblteks.FontUnderline = True
Else
    Lblteks.FontUnderline = False
End If
End Sub

Private Sub Optblue_Click()
‘cara Membuat Teks bewarna biru’
Lblteks.ForeColor = vbBlue

End Sub

Private Sub Optgreen_Click()
‘cara Membuat Teks bewarna hijau’
Lblteks.ForeColor = vbGreen

End Sub

Private Sub Optred_Click()
‘cara membuat Teks berwarna merah’
Lblteks.ForeColor = vbRed

End Sub

Private Sub optyellow_Click()
‘cara Membuat Teks bewarna kuning’
Lblteks.ForeColor = vbYellow

End Sub

Private Sub Cmdexit_Click()
Unload Me
End Sub
.

Langsung run program nya

image

Selamat mencoba.👌