vendredi 29 mars 2019

using return in If Statement Vb.net

so i want to use a return in a If Statement thats return in a part of the code :( i want to check if the condition is valid in every DataGridView cells, so it will verify the first value if the condition not valid then it will check the second value without do any action. i hope thats clear

For i As Integer = 0 To DataGridView1.RowCount - 1
                    ' ruturn here !
                    If DataGridView1.Rows(i).Cells(6).Value = dt.Rows(0)(5) Then

                        DataGridView1.Rows(i).Cells(4).Value += 1
                    Else
                        If i = DataGridView1.RowCount - 1 Then
                            DataGridView1.Rows.Add(i + 1, dt.Rows(i)(0), dt.Rows(i)(1), dt.Rows(i)(2), qnt, dt.Rows(i)(4), dt.Rows(i)(5))
                        Else
                            Return 'return to scan the second row ( i = 1,2,3... etc)
                        End If
                    End If
                Next

Aucun commentaire:

Enregistrer un commentaire