how to know which row number is positioned in vb in a foreach cycle?

0

How to know which row number is positioned in vb in a for each? I am trying the form row.CurrentRow.Index but it tells me:  The public member 'CurrentRow' can not be found in the 'DataGridViewRow' type.

    Dim ultimo = Datos.Rows(Datos.Rows.Count - 1)
    For Each row In Datos.Rows
        Dim fecha1 = row.Cells(4).Value.ToString()
        Dim fecha2 = row.Cells(5).Value.ToString()
        If row.Cells(4).Value.ToString() <> "" And row.Cells(5).Value.ToString() <> "" Then
            If row.CurrentRow.Index <> ultimo Then
    
asked by Acd 23.04.2017 в 05:00
source

1 answer

0

You can get it with:

Datos.Rows.indexOf(row)

Example:

     For Each row In Datos.Rows
        Write(Datos.Rows.IndexOf(row) & " = " & row)'
    
answered by 23.04.2017 / 05:12
source