|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
What does this ERROR mean ?
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
__________________
Last edited by Watever : September 18th, 2003 at 04:45 PM. |
|
#2
|
|||
|
|||
|
that's about the same error as a data type mismatch. it could be because objRue is an object (i assume) and you are passing it to a function that requries a string.
try: Code:
drDataRowRue = FindRue(CStr(objRue), nomVille, dsDataSetRue)
__________________
Programmer's Corner |
|
#3
|
|||
|
|||
|
I have found my stupid error. But wanted to tell you the error wasn't in the objRue, I checked it out. An string is an object so there is no error on it, it's just hierarchie.
the error came from the third line. Code:
For Each objRue In cboRue.Items
i = i + 1
drDataRowRue = FindRue(CStr(objRue), nomVille, dsDataSetRue)
[b]tabNoRue(i) = drDataRowRue.Item("norue")[/rue]
Next
that's where the error is part from. the real bug was created from different error, one of them was the table. Last edited by Watever : September 23rd, 2003 at 09:33 AM. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > .Net Development > What does this ERROR mean ? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|