Private Sub cmdAddPro_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAddPro.Click
For I As Integer = 0 To Me.DG2.Rows.Count - 1
If Me.txtp_id.Text = Me.DG2.Rows(I).Cells(0).Value.ToString Then
Me.DG2.Rows(I).Cells(2).Value = CInt(Val(Me.txtin_qnt.Text.Trim)).ToString
Me.ClearPro()
Exit Sub
End If
Next
Dim item(4) As String
item(0) = Me.txtp_id.Text.Trim ' ให้ คอลัมที่ 1 เท่ากับTextBox
item(1) = Me.Label1.Text.Trim 'ให้เท่ากับ label
item(2) = CInt(Val(Me.txtin_qnt.Text.Trim)).ToString
item(3) = Me.lblp_unit.Text.Trim
item(5) = Me.txtp_penalty.Text.Trim
item(4) = Me.txtd_qnt.Text.Trim
Me.DG2.Rows.Add(item)
End Sub