kwangu

Insert records on User Control DatagidView from Form DGV

Sep 2nd, 2017
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.15 KB | None | 0 0
  1. For Each row As DataGridViewRow In DataGridView1.Rows
  2.                 pID = row.Cells("productID").Value.ToString()
  3.                 pcode = row.Cells("ProductCode").Value.ToString()
  4.                 pname = row.Cells("ProductName").Value.ToString()
  5.                 price = row.Cells("SellingPrice").Value.ToString()
  6.                 total = row.Cells("SellingPrice").Value * 1
  7.                 If row.Cells("chk").Value = True Then
  8.                     'before adding check if the product is already added to the list
  9.                     For ii = 0 To .RowCount - 1
  10.                         If pID = .Item(2, ii).Value Then
  11.                             count = count + 1
  12.                             If count <> 0 Then
  13.                                 'if item exist do not add the product
  14.                             Else
  15.                                 '
  16.                             End If
  17.                         End If
  18.                     Next ii
  19.                     If count = 0 Then
  20.                         .Rows.Add("Delete", "Select", pID, pcode, pname, "", price, 1, total, 0, 0, total)
  21.                     End If
  22.                 End If
  23.             Next
Add Comment
Please, Sign In to add comment