Private Sub Btncal_Click(sender As System.Object, e As System.EventArgs) Handles Btncal.Click
txtAmt.Text = 0 '--- clear ค่าใน label QTY ก่อน
txtPrice.Text = 0.0 '--- clear ค่าใน label Total Money ก่อน
For i As Int16 = 0 To 330
txtAmt.Text += DataGridView1.Rows(i).Cells(2).Value
txtPrice.Text += DataGridView1.Rows(i).Cells(4).Value
Next
txtTotal.Text = txtAmt.Text
'--- จัดรูปแบบ ยอดสุทธิ -----------------------------------------------------
Dim X As Double
X = txtAmt.Text
txtTotal.Text = Format(X, "#,#.00฿")
End Sub
Dim Total As Double = 0
For i As Integer = 0 To DataGridView1.RowCount - 1
Total += DataGridView1.Rows(i).Cells(1).Value * DataGridView1.Rows(i).Cells(2).Value
Next