Une exception non gérée du type 'System.InvalidCastException' s'est produite dans Projet_DTI.exe
Informations supplémentaires_: Le cast spécifié n'est pas valide.
sorry I am working on a french station !
If I translate it, it's mean
An exception have not been managed (taked care of) of type 'System.InvalidCastException'
Additionnal information : The specific cas is not valid.
What does that mean ?
here is the code where that happens
Code:
For Each objRue In cboRue.Items
i = i + 1
drDataRowRue = FindRue(objRue, nomVille, dsDataSetRue)
tabNoRue(i) = drDataRowRue.Item("norue")
Next
and the error happens on the third line (drdatarowrue =....)
and here is what is findrue
Code:
Function FindRue(ByVal NomRue As String, ByVal NomVille As String, ByRef DataSetRue As DataSet) As _
DataRow
'Déclare une ligne dans la table des villes
Dim drDataRowVille As DataRow
'Déclare une ligne dans la table RUE
Dim drDataRowRue As DataRow = Nothing
'Déclare une ligne temporaire dans la table RUE
Dim drDataRowRueTEMP As DataRow
drDataRowVille = FindVille(NomVille, frmItems.DataSetVille1)
If Not (drDataRowVille Is Nothing) Then
For Each drDataRowRueTEMP In DataSetRue.Tables("Rue").Rows
If CStr(drDataRowRueTEMP.Item("rue")).ToUpper = NomRue.ToUpper And _
drDataRowRueTEMP.Item("noVille") = drDataRowVille.Item("noVille") Then
drDataRowRue = drDataRowRueTEMP
Exit For
End If
Next
End If
Return drDataRowRue
End Function