Ini Coding Di Class Nya Kode Namabarang Stok Harga - Kode Kode (Value) Kode Value
This document contains code for a class called Stok that defines properties for storing product stock data including code, name, quantity, and price. It also contains code for a form that loads this data into a datagrid and calculates total price by multiplying quantity by price when a process button is clicked. The data is then added as a new row to the datagrid.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
119 views2 pages
Ini Coding Di Class Nya Kode Namabarang Stok Harga - Kode Kode (Value) Kode Value
This document contains code for a class called Stok that defines properties for storing product stock data including code, name, quantity, and price. It also contains code for a form that loads this data into a datagrid and calculates total price by multiplying quantity by price when a process button is clicked. The data is then added as a new row to the datagrid.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
Ini coding di class nya
Public Class Stok
Private Kode As String Private NamaBarang As String Private Stok As Integer Private harga As Integer Property _kode() As String Get Return Kode End Get Set(ByVal value As String) Kode = value End Set End Property Property _namabarang() As String Get Return NamaBarang End Get Set(ByVal value As String) NamaBarang = value End Set End Property Property _stok() As String Get Return Stok End Get Set(ByVal value As String) Stok = value End Set End Property Property _harga() As String Get Return harga End Get Set(ByVal value As String) harga = value End Set End Property End Class
Ini coding ditombol prosesnya
Dim stokbarang As New Stok
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DataGridView1.ColumnCount = 5 DataGridView1.Columns(0).Name = "Kode" DataGridView1.Columns(0).Width = 40 DataGridView1.Columns(1).Name = "Nama Barang" DataGridView1.Columns(1).Width = 150 DataGridView1.Columns(2).Name = "Stok" DataGridView1.Columns(2).Width = 60 DataGridView1.Columns(3).Name = "Harga" DataGridView1.Columns(3).Width = 60 DataGridView1.Columns(4).Name = "Total Barang" DataGridView1.Columns(4).Width = 70 End Sub Private Sub btnproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnproses.Click With stokbarang ._kode = Trim(txtkode.Text) ._namabarang = Strings.Trim(txtnamabrg.Text) ._stok = Strings.Trim(txtstok.Text) ._harga = Strings.Trim(txtharga.Text) End With Dim total As Double total = CInt(txtstok.Text) * CDbl(txtharga.Text) DataGridView1.Rows.Add(New String() {txtkode.Text, txtnamabrg.Text, txtstok.Text, Strings.Format(CDbl(txtharga.Text), "#,#0"), Strings.Format(CDbl(total), "#,#0")}) End Sub End Class