visual basic

Friday, August 3, 2012


vb 6 ato visual besik 6..
yup merupaka sala satu matakulaih paporit saya di semester 3 kemaren..., suka bukan berarti mahir lho gan... :D

dengan memperlajari vb kita bisa membuat applikasi-aplikasi sederhara sampe yang rumit-rumit, oy bikin game di vb juga bisa :D, tapi level'y bukan u/ pemula kaya saya ini :D
di semester kemaren ane belajar besic'y saja sich.. n membuat beberapa aplikasi sederhana.. misalnya
aplikasi penjualan yang diintegrasika dengan database yang dibuat di ms. office acces

print screen aplikasi penjualan PT. UDIN MAKMUR :D

setelah di run n sukses hasilnya seperti ini ^^


sedangkan database yang digunakan adahal ms. access, ini database'y

:) utuk cara pembuatan langkah perlangkahnya mungkin dilanjutkan pada post selanjutnya (insyaallah)
berikut listing'y 
Dim x As Control
Sub auto()
Dim urut As String * 4
Dim hitung As Integer
With dttrans.Recordset
If .RecordCount = 0 Then
txtnofak = "F" + "001"
Else
.MoveLast
urut = Val(Right(!notrans, 3))
hitung = urut + 1
If hitung < 10 Then
txtnotrans = "F" + "00" + Trim(Str(hitung))
Else
txtnotrans = "F" + Trim(Str(hitung))
End If
End If
End With
End Sub

Private Sub cmdclose_Click()
P = MsgBox("Anda yakin akan keluar", vbQuestion + vbOKCancel, "Informasi")
If P = vbOK Then
End
End If
End Sub

Private Sub cmdnew_Click()
dttrans.Recordset.AddNew
aktif
bersih
txtnotrans.SetFocus
cmdsave.Enabled = True
cmdnew.Enabled = False
txtnmcust.Enabled = False
txtalamat.Enabled = False
txtnotelp.Enabled = False
txtnmbrg.Enabled = False
txthrg.Enabled = False
txttgltrans.Enabled = False
txttotal.Enabled = False
txtkembali.Enabled = False
End Sub

Private Sub cmdsave_Click()
On Error Resume Next
With dttrans.Recordset
!notrans = txtnotrans.Text
!tgltrans = txttgltrans.Text
!kdcust = DBCombo1
!kdbrg = DBCombo2
!jmlbeli = txtjmlbeli.Text
!total = txttotal.Text
.Update
DBGrid1.Refresh
nonaktif
cmdsave.Enabled = False
cmdnew.Enabled = True
End With
End Sub

Private Sub DBCombo1_Change()
On Error Resume Next
dtcust.Recordset.Index = "xkdcust"
dtcust.Recordset.Seek "=", DBCombo1
If Not dtcust.Recordset.NoMatch Then
txtnmcust.Text = dtcust.Recordset!nmcust
txtalamat.Text = dtcust.Recordset!alamat
txtnotelp.Text = dtcust.Recordset!telp
End If
End Sub

Private Sub DBCombo2_Change()
dtbrg.Recordset.Index = "xkdbrg"
dtbrg.Recordset.Seek "=", DBCombo2
If Not dtbrg.Recordset.NoMatch Then
txtnmbrg.Text = dtbrg.Recordset!nmbrg
txthrg.Text = dtbrg.Recordset!harga
'txtjmlbeli.SetFocus
End If
End Sub

Private Sub Form_Activate()
cmdsave = True
End Sub

Private Sub Form_Load()
cmdsave.Enabled = False
nonaktif
bersih
End Sub
Private Sub nonaktif()
For Each x In Me
If TypeName(x) = "TextBox" Then
x.Enabled = 0
End If
Next x
End Sub
Private Sub aktif()
For Each x In Me
If TypeName(x) = "TextBox" Then
If TypeName(x) = "DBCOmbo" Then x.Enabled = False
x.Enabled = 1
End If
Next x
End Sub
Private Sub bersih()
For Each x In Me
If TypeName(x) = "TextBox" Then
x.Text = ""
End If
Next x
DBCombo1.Text = "Pilih Kode"
DBCombo2.Text = "Pilih Kode"
txtkembali.Text = ""
End Sub

Private Sub Timer1_Timer()
txttgltrans.Text = Format(Date, "dd/mm/yy")
End Sub

Private Sub txtbayar_Change()
txtkembali.Text = Val(txtbayar.Text) - Val(txttotal.Text)
End Sub

Private Sub txtjumbel_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txttotal.Text = Val(txthrg.Text * txtjumbel.Text)
txtbayar.SetFocus
End If
End Sub

Private Sub txtjmlbeli_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txttotal.Text = Val(txthrg.Text * txtjmlbeli.Text)
txtbayar.SetFocus
End If
End Sub


bersambung.... ^^






Free Template Blogger collection template Hot Deals BERITA_wongANteng SEO theproperty-developer

0 comments:

Post a Comment