Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I understand that you want to set two nested loops accounting for an undetermined number of elements (items in an array of <code>DataGridView</code>, I presume), performing the checks you want:</p> <pre><code> For count1 As Integer = 1 To dgvCont 'Assuming indices from 1 to dgvCont For row1 As Integer = 0 To Main.DGVM(count1).Rows.Count - 1 If (Main.DGVM(count1).Rows(row1).Cells(0).Value Is Nothing) Then Continue For Dim val1 As String = Main.DGVM(count1).Rows(row1).Cells(0).Value Dim found As Boolean = False For count2 As Integer = 1 To dgvCont 'Assuming indices from 1 to dgvCont If (count2 = count1) Then Continue For For row2 As Integer = 0 To Main.DGVM(count2).Rows.Count - 1 If (Main.DGVM(count2).Rows(row2).Cells(0).Value Is Nothing) Then Continue For Dim val2 As String = Main.DGVM(count2).Rows(row2).Cells(0).Value.ToString() If val1 = val2 Then Dim cm As String = val1 If cm = "" Then Else Analysis.lvCmn.Items.Add(val1) End If found = True Exit For 'By assuming that you want to stop searching after finding a match End If Next If (found) Then Exit For 'By assuming that you want to stop searching after finding a match Next Next Next </code></pre> <p>Your code is not too clear (neither what you want); but this should give you a good enough start to carry out the implementation you are looking for. Bear in mind that this code (like yours) only considers one column (first one); in case of wanting to iterate through all the columns, you would have to add further nested loops accounting for that.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload