?
=?ISO-8859-1?Q?Bernard_Bour=E9e?=
Hello
I have the following code:
Public Groupes As New Hashtable
Dim Entry As DictionaryEntry
For Each Entry In Groupes
Dim Gr As Groupe = DirectCast(Entry.Value, Groupe)
===> THIS LINE GIVE ME AN ERROR DIRECTCAST IS NOT VALID
Next
Can someone tell me what I'm doing wrong ?
Thanks
Bernard
PS: Here is my class Groupe
Friend Class Groupe
Private mNom As String
Private mNum As Short
Private mCat As Quotes.CatABC
' Stockage pour le numéro ID de débogage.
Private mlDebugID As Integer
Public Property Nom() As String
Get
Nom = mNom
End Get
Set(ByVal Value As String)
mNom = Value
End Set
End Property
Public Property Num() As Short
Get
Num = mNum
End Get
Set(ByVal Value As Short)
mNum = Value
End Set
End Property
Public Property Cat() As Quotes.CatABC
Get
Cat = mCat
End Get
Set(ByVal Value As Quotes.CatABC)
mCat = Value
End Set
End Property
Public Sub New()
MyBase.New()
End Sub
Protected Overrides Sub Finalize()
MyBase.Finalize()
End Sub
End Class
I have the following code:
Public Groupes As New Hashtable
Dim Entry As DictionaryEntry
For Each Entry In Groupes
Dim Gr As Groupe = DirectCast(Entry.Value, Groupe)
===> THIS LINE GIVE ME AN ERROR DIRECTCAST IS NOT VALID
Next
Can someone tell me what I'm doing wrong ?
Thanks
Bernard
PS: Here is my class Groupe
Friend Class Groupe
Private mNom As String
Private mNum As Short
Private mCat As Quotes.CatABC
' Stockage pour le numéro ID de débogage.
Private mlDebugID As Integer
Public Property Nom() As String
Get
Nom = mNom
End Get
Set(ByVal Value As String)
mNom = Value
End Set
End Property
Public Property Num() As Short
Get
Num = mNum
End Get
Set(ByVal Value As Short)
mNum = Value
End Set
End Property
Public Property Cat() As Quotes.CatABC
Get
Cat = mCat
End Get
Set(ByVal Value As Quotes.CatABC)
mCat = Value
End Set
End Property
Public Sub New()
MyBase.New()
End Sub
Protected Overrides Sub Finalize()
MyBase.Finalize()
End Sub
End Class