ArgumentOutOfRangeException et dataGridView
Bonjour,
J'ai 2 DataGridView. Le premier contient 2 colonnes : AgeFemme et Nom.
Le deuxième même chose : AgeHomme et Nom.
J'ai un 3ième DGV qui va parcourir chacun des deux autres DGV, on fait la somme AgeHomme + AgeFemme de chaque ligne, si somme > 100 on met alors leurs noms dans le 3ième DGV. J'arrive pas à m'en sortir de l'exception suivante :
Citation:
ArgumentOutOfRangeException...
Voilà mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
For i2 = 0 To (len1 - 1)
For i3 = 0 To (len2 - 1)
somme = 0
agefem = Form1.DGV1.Rows(i2).Cells(0).Value
agehom = Form1.DGV2.Rows(i3).Cells(0).Value
somme = agefem + agehom
if (somme > 100)
Try
DGV3.Rows(k).Cells(0).Value = DGV1.Rows(i2).Cells(1).Value
DGV3.Rows(k).Cells(1).Value = DGV2.Rows(i3).Cells(1).Value
k = k + 1
Catch ed As NullReferenceException
Catch es As ArgumentOutOfRangeException
End Try
End If
Next i3
Next i2 |