example of visual basic

Posted on 18.28 by roni setiawan | 0 komentar

PROGRAM DESCRIPTION
 
MAKE A CONNECTION

Once we create a database using Microsoft Access, then we make the connection between the program that we created in Visual Basic with databases before, here I create a database with namadbpembelian and create two tables that I give the name dengantblbarang and
tblpembelian, and then we will make a connection with the use of

DataEnvironment, do the following:
-Click the Project menu Add Data Environment
After that a window will appear like this:
Then right click on connection1 select rename the connection name in accordance
I love your needs here db name purchases
- Right click on dbpembelian and select properties and select Microsoft Jet 4.0 OLE DB Provider Then take the next test database connection if successful proceed with OK

- Right-click again on the db purchase and select the add command, here I add 3 pieces of command who I give the buyer a name tbl, tbl goods, and tbl purchases

- Having all the command is created right click on each command and select properties and on the General tab enter the SQL commands on each table I love the command as follows:
-TBL buyers:
-select
_ Name of Buyer, Nama_ Goods, Price _ Goods, Jumlah_ Buy, Total_ Pay
from tbl purchases
-TBL items: select * from tbl goods
-TBL purchase: select * from tbl purchases

- After all tables have been successful with its SQL command, then we are still in their respective tables properties that had, in general tab and now select the advanced tab and change all its table lock type with Optimistic

- And after all a successful connection is created we proceed with designing forms, and to speed up we can just slide from each table to each form, in order to create a label and textbox.
FORM MENU
 
In the form we create a menu using the menu

using the Menu Editor tool, and we designed the following menu
- Menu Master File menu in it there is Form and Form Buyers of Goods
- Transactions in which there are menu Menu Form Purchase and Purchase Report
- And the last is the Exit menu
FORM PEMBELI
 
Here I just add a DataGrid to display the buyers
 
FORM OF GOODS
 
I add some of the Command button that serves to manipulate the data items that are sold by the store, I added a command such as Add, Save, Cancel, Delete, and Exit.
In addition I also added a DataGrid command to display the
goods sold by the store.
 
PURCHASE FORM
 
In the latter form of purchase form I added a ComboBox which serves to connect the table to the next item will display the name of the goods and the price of goods in accordance with the stored on tblbarang and will appear in the form of purchase, and will be stored in a table of purchase and will also be generated a sales report.
In addition, I also add some command buttons such as the
I've added in the form of goods.
And lastly I also added two DataGrid that is to
Purchase and display the data items that are sold by the store.

REPORT
 
end Sub
BUYER FORM
Not Wearing Listing Program
FORM OF GOODS

Private Sub cmdbatal_Click ()
txtKd_Barang.Text = ""
txtNama_Barang.Text = ""
txtHarga_Barang.Text = ""
end Sub
Private Sub cmdhapus_Click ()

DataEnvironment1.rstblbarang.Delete
end Sub
Private Sub cmdkeluar_Click ()
end
end Sub
Private Sub cmdsimpan_Click ()

DataEnvironment1.rstblbarang.Update
end Sub
Private Sub cmdtambah_Click ()

DataEnvironment1.rstblbarang.AddNew
end Sub
Private Sub Form_Load ()
end Sub
PURCHASE FORM

Private Sub cmbbarang_Click ()
DataEnvironment1.rstblbarang.MoveFirst
DataEnvironment1.rstblbarang.Find "Kd_Barang = '" + cmbbarang.Text + "'"
8

txtNama_Barang.Text =
DataEnvironment1.rstblbarang.Fields ("Nama_Barang"). Value
txtHarga_Barang.Text =
DataEnvironment1.rstblbarang.Fields ("Harga_Barang"). Value
end Sub

Private Sub cmdbatal_Click ()
txtKd_Pembeli.Text = ""
txtNama_Pembeli.Text = ""
cmbbarang.Text = "Select"
txtNama_Barang.Text = ""
txtHarga_Barang.Text = ""
txtJumlah_Beli.Text = ""
txtTotal_Bayar.Text = ""
end Sub

Private Sub cmdhapus_Click ()
DataEnvironment1.rstblpembalian.Delete
end Sub

Private Sub cmdkeluar_Click ()
end
end Sub

Private Sub cmdsimpan_Click ()
DataEnvironment1.rstblpembalian! Kd_Barang = cmbbarang.Text
DataEnvironment1.rstblpembalian.Update
end Sub
Private Sub cmdtambah_Click ()

DataEnvironment1.rstblpembalian.AddNew
end Sub
Private Sub Form_Load ()

For i = 1 To DataEnvironment1.rstblbarang.RecordCount
cmbbarang.AddItem DataEnvironment1.rstblbarang.Fields ("Kd_Barang"). Value
DataEnvironment1.rstblbarang.MoveNext
Next i
end Sub
9

Private Sub txtJumlah_Beli_Change ()
txtTotal_Bayar.Text = Val (txtHarga_Barang.Text) * Val (txtJumlah_Beli.Text)
end Sub