Pages

Subscribe:

Ads 468x60px

Labels

Senin, 19 September 2011

Program Sederhana untuk VB

Pemrograman Sederhana Visual Basic

Tutorial VB ini membahasa pembuatan program vb sederhana menggunakan adodc database.



Sedikit bingung juga sih maksudnya ini program, karena diciptakan seala kadarnya saja..hehehehe
Perogram ini dibuat karena ada tugas dari dosen lab yang nyuruhnya ada2 aja...haaaahhhh

Penjelasan tentang program ini

Program ini dibuat dengan visual basic. Koneksikan adodc ke dalam sebuah combobox yang akan otomatis menampilkan isi database didalamnya, sehingga memudahkan kita dalam bekerja.
Tidak perlu berlama-lama, bagi kalian yang membutuhkannya silahkan copy code dibawah ini:

Option Explicit

Private Sub Command1_Click()
End
End Sub

Private Sub Command2_Click()
Adodc2.Recordset.AddNew
Adodc2.Recordset!no_invo = no_invo.Text
Adodc2.Recordset!tgl = DTPicker1.Value
Adodc2.Recordset!kode_barang = kode_barang.Text
Adodc2.Recordset!kode_customer = okay.Text
Adodc2.Recordset!jumlah_beli = jumlah.Text
Adodc2.Recordset!total = total.Text
Adodc2.Recordset.Update
bersih
mati
Command3.Enabled = True
End Sub

Private Sub Command3_Click()
aktif
oto
Command3.Enabled = False
Command2.Enabled = True
End Sub

Sub bersih()
Dim bersih1, bersih2 As Control
For Each bersih1 In Me.Controls
For Each bersih2 In Me.Controls
If TypeOf bersih1 Is TextBox Then bersih1.Text = ""
If TypeOf bersih2 Is ComboBox Then bersih2.Text = ""
Next
Next
End Sub

Sub mati()
Dim mati1, mati2, mati3 As Control
For Each mati1 In Me.Controls
For Each mati2 In Me.Controls
For Each mati3 In Me.Controls
If TypeOf mati1 Is TextBox Then mati1.Enabled = False
If TypeOf mati2 Is ComboBox Then mati2.Enabled = False
If TypeOf mati3 Is CommandButton Then mati3.Enabled = False
Next
Next
Next
End Sub

Sub aktif()
Dim aktif1, aktif2 As Control
For Each aktif1 In Me.Controls
For Each aktif2 In Me.Controls
If TypeOf aktif1 Is TextBox Then aktif1.Enabled = True
If TypeOf aktif2 Is ComboBox Then aktif2.Enabled = True
Next
Next
End Sub

Sub oto()
Dim nomor, otomatis As String
If Adodc2.Recordset.RecordCount = 0 Then
otomatis = "B-001"
Else
Adodc2.Recordset.MoveLast
nomor = Right(Adodc2.Recordset!no_invo, 3) + 1
otomatis = "B-" & Right("000" & nomor, 3)
End If
no_invo.Text = otomatis
End Sub

Private Sub Form_Load()
kode_brg
kode_cus
mati
Command3.Enabled = True
End Sub

Sub kode_brg()
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveFirst
While Not Adodc1.Recordset.EOF
kode_barang.AddItem Adodc1.Recordset!kode_barang
Adodc1.Recordset.MoveNext
Wend
End If
End Sub

Sub kode_cus()
If Adodc3.Recordset.RecordCount > 0 Then
Adodc3.Recordset.MoveFirst
While Not Adodc3.Recordset.EOF
okay.AddItem Adodc3.Recordset!kode_customer
Adodc3.Recordset.MoveNext
Wend
End If
End Sub

Private Sub jumlah_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
total.Text = Val(harga.Text) * Val(jumlah.Text)
End If
End Sub

Private Sub kode_barang_change()
Adodc1.RecordSource = "select * from barang where kode_barang='" & kode_barang.Text & "'"
With Adodc1.Recordset
Adodc1.Recordset!nama_barang = nama_brg.Text
harga.Text = Adodc1.Recordset!harga_jual
End With
End Sub

Private Sub okay_change()
Adodc3.RecordSource = "select * from customer where kode_customer='" & okay.Text & "'"
Adodc3.Recordset!nama_customer = nama_cus.Text
nama_cus.Text = Adodc3.Recordset!nama_customer
End Sub



 Kalau kalian suka dengan artikel ini, like dengan FB. Jika kalian masih kurang mengerti, silahkan bertanya dicomment postingan ini. Program ini dibuat dengan Visual Basic
Semoga bermanfaat

1 komentar:

Unknown mengatakan...

Semoga Usaha Anda semakin JAYA Dan SUKSES. Kami akan

selalu MENDUKUNG dan MENSUPPORT Anda.

JANGAN LUPA ACARA kami di Padang:
http://www.facebook.com/events/191370067624725/

Posting Komentar