Tuesday, July 17, 2012

belajar membuat aplikasi dengan menggunakan visual basik 60

selamat pagi temen ni saya mau posting tentang visual basic belajar membuat aplikasi dengan menggunakan visual basik 60

berikut ini saya kasih scriptnya



Private Sub cariedit()
Adodc1.Recordset.Find "Kode_barang = '" + Text1.Text + "'", , adSearchForward, 1
If Not Adodc1.Recordset.EOF Then


'Text1.Text = Adodc1.Recordset!kode_barang
Text2.Text = Adodc1.Recordset!nama_barang
Text3.Text = Adodc1.Recordset!harga_jual
Text4.Text = Adodc1.Recordset!harga_beli
Text5.Text = Adodc1.Recordset!stock




baca selengkapnya >>>




Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = ture




Else


Command1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True


Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""


End If
End Sub
Private Sub pencarian()


'rumus pencarian
Adodc1.Recordset.Find "Kode_barang = '" + Text1.Text + "'", , adSearchForward, 1
If Not Adodc1.Recordset.EOF Then


'Text1.Text = Adodc1.Recordset!kode_barang
Text2.Text = Adodc1.Recordset!nama_barang
Text3.Text = Adodc1.Recordset!harga_jual
Text4.Text = Adodc1.Recordset!harga_beli
Text5.Text = Adodc1.Recordset!stock




'Command1.Enabled = False


Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False




Else


Command1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True


Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""


End If
End Sub
Private Sub isi()
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True


Command2.Enabled = True
Command3.Enabled = True


End Sub
Private Sub kosong()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""


End Sub
Private Sub awal()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False


Command2.Enabled = True
Command3.Enabled = True


End Sub
Private Sub Command1_Click()
Call kosong
If Command1.Caption = "INPUT" Then
Call isi
Text1.SetFocus
Command1.Caption = "SIMPAN"


Else
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Then
MsgBox "Maaf SEBAGIAN DATA ada yang belum di isi.?", vbInformation
Else


Adodc1.Recordset.AddNew
Adodc1.Recordset!kode_barang = Text1.Text
Adodc1.Recordset!nama_barang = Text2.Text
Adodc1.Recordset!harga_jual = Val(Text3.Text)
Adodc1.Recordset!harga_beli = Val(Text4.Text)
Adodc1.Recordset!stock = Text5.Text


Adodc1.Recordset.Update
Adodc1.Recordset.Requery


MsgBox "selamat data berhasil di simpan", vbInformation


Command1.Caption = "INPUT"
Call kosong
End If
End If
End Sub


Private Sub Command1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text1.SetFocus
End If
End Sub


Private Sub Command2_Click()
Call kosong
Call cariedit
'Text1.SetFocus
If Command2.Caption = "EDIT" Then
Command2.Caption = "UBAH"
Command1.Enabled = False
Command3.Enabled = False
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True


Text1.SetFocus


Else
Dim Berubah As Integer
  Berubah = MsgBox("apakah anda yakin akan merubah data.?", vbQuestion + vbYesNo, "Edit")
     
  If Berubah = vbYes Then
Adodc1.Recordset!kode_barang = Text1.Text
Adodc1.Recordset!nama_barang = Text2.Text
Adodc1.Recordset!harga_jual = Val(Text3.Text)
Adodc1.Recordset!harga_beli = Val(Text4.Text)
Adodc1.Recordset!stock = Text5.Text




Adodc1.Recordset.Update
Adodc1.Recordset.Requery
Call kosong
Command2.Caption = "EDIT"
Command1.Enabled = False
Command3.Enabled = False


   End If
End If


End Sub


Private Sub Command3_Click()
Text1.Enabled = True
Text1.SetFocus
Adodc1.Recordset.Find "Kode_barang = '" + Text1.Text + "'", , adSearchForward, 1
If Not Adodc1.Recordset.EOF Then




Dim hapus As Integer
hapus = MsgBox("apa anda yakin ingin menghapu data ini.??", vbInformation + vbYesNo)
If hapus = vbYes Then


Adodc1.Recordset.Delete
Adodc1.Recordset.Update
End If
End If
End Sub


Private Sub Command4_Click()
Dim takon As Integer
takon = MsgBox("apa benar anda mau keluar..???", vbQuestion + vbYesNo)
If takon = vbYes Then


Unload Me
End If
End Sub


Private Sub Command5_Click()
Unload Me
Form1.Show
End Sub


Private Sub Command6_Click()
laporan.ReportFileName = App.Path & "\laporan data barang.rpt"
laporan.WindowState = crptMaximized
laporan.RetrieveDataFiles
laporan.Action = 1


End Sub


Private Sub DataGrid1_Click()
DataGrid1.ForeColor = vbBlue


Text1.Text = Adodc1.Recordset!kode_barang
Text2.Text = Adodc1.Recordset!nama_barang
Text3.Text = Adodc1.Recordset!harga_jual
Text4.Text = Adodc1.Recordset!harga_beli
Text5.Text = Adodc1.Recordset!stock
Call isi
End Sub


Private Sub file_Click()


End Sub


Private Sub Form_Load()
Call awal




End Sub


Private Sub pencarian_Click()


End Sub


Private Sub Image2_Click()


End Sub


Private Sub Text1_Change()
Text1.Font = timesnewroman
Text1.ForeColor = vbRed
Text1.FontSize = 12
Call pencarian


End Sub


Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub


Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text4.SetFocus
End If
End Sub


Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text5.SetFocus
End If
End Sub


Private Sub Text5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub


Private Sub Timer1_Timer()
Label4.Caption = Date
Label5.Caption = Time
Label3.Caption = Mid(Label3, 2, Len(Label3) - 1) + Left(Label3, 1)
End Sub
berikut ini programnya barang kali mau download program  disini saya harap di modifikasi yah karena di saya rusak terus kalo gak jalan saya mohon maaf karena itu kekurangan saya

No comments:

Post a Comment

silahkan masukan kritikan yang membangun