Sub showsum()
Dim i As Integer
Dim summ As Integer = 0
Dim dis As Integer = 0
Dim dis1 As Double = txtdis.Text(ช่องที่รับค้าส่วนลด ex.5% ครับ)
Dim total As Integer = 0
For i = 0 To dgvproduct.Rows.Count - 1
summ = dgvproduct.Rows(i).Cells(3).Value * dgvproduct.Rows(i).Cells(4).Value + summ
(dgv3 = ราคาสินค้า ,dgv4=จำนวนที่สั่งซื้อ)
dis = summ * dgvproduct.Rows(i).Cells(9).Value + dis (dgv9=ส่วนลด ex5%)
total = summ - dis1 + total
Next
txtallprice.Text = summ
txttotol.Text = summ + txtarrears.Text
End Sub