kwangu

Re-arranging merged lists items

Jan 26th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.77 KB | None | 0 0
  1. Dim category As New List(Of String)
  2.  Dim products As New List(Of String)
  3.  
  4.  'concantenate category
  5.         For i As Integer = 0 To Me.dgvData.Rows.Count - 1
  6.             If dgvData.Rows(i).Cells("chk").Value = True Then
  7.                 category.Add(dgvData.Rows(i).Cells("catName").Value)
  8.             End If
  9.         Next
  10.         Dim combinedCategory As String = String.Join(", ", category)
  11.  
  12.         'concantenate products
  13.         For i As Integer = 0 To Me.dgvData.Rows.Count - 1
  14.             If dgvData.Rows(i).Cells("chk").Value = True Then
  15.                 products.Add(dgvData.Rows(i).Cells("ProdName").Value)
  16.             End If
  17.         Next
  18.         Dim combinedProducts As String = String.Join(", ", products)
  19.  
  20. descriptive = combinedCategory  & ", " & combinedProducts
Add Comment
Please, Sign In to add comment