kershin
Messages postés8Date d'inscriptionsamedi 8 mars 2003StatutMembreDernière intervention10 novembre 2004
-
7 avril 2004 à 15:30
kershin
Messages postés8Date d'inscriptionsamedi 8 mars 2003StatutMembreDernière intervention10 novembre 2004
-
7 avril 2004 à 16:26
Bonjour à tous,
J'ai du pour des raisons professionnelles me mettre au VB depuis une petite semaine. Jusqu'ici tout allait bien, mais je suis confronté ici à une petite énigme que je n'arrive pas à résoudre.
Pour résumer, j'ai 3 classes: list, folder et auction. List contient un tableau de folder, et chaque folder contient un tableau d'auction. Je récupère toutes les données à partir d'un fichier xml.
le problème que je rencontre est que je parviens sans problème à faire ceci:
dim bytIndexFolder as byte
bytIndexFolder = 1
For Each oNode In oNodeList
Set oaFolders(bytIndexFolder) = New Folder
bytIndexFolder = bytIndexFolder + 1
Next
Par contre, l'initialisation de l'objet suivant (auction) dans l'arborescence pose problème en raison je pense du property de la classe Folder. Ceci ne fonctionne donc pas:
dim intIndexAuction as integer
intIndexAuction = 1
For Each oSubNode In oSubNodeList
Set oaFolders(bytIndexFolder).Auctions(intIndexAuction) = New Auction
Next
voici la composition de ma classe Folder:
Option Explicit
Private bytIdFolder As Byte
Private strNom As String
Private strDescription As String
Private oaAuctions() As Auction
Public Sub ResizeAuctionsArray(ByVal Index As Integer)
ReDim oaAuctions(Index)
End Sub
Public Property Get Nom() As String
Nom = strNom
End Property
Public Property Let Nom(ByVal NewValue As String)
strNom = NewValue
End Property
Public Property Get Description() As String
Description = strDescription
End Property
Public Property Let Description(ByVal NewValue As String)
strDescription = NewValue
End Property
Public Property Get Auctions(ByVal Index As Integer) As Object
Auctions = oaAuctions(Index)
End Property
Public Property Get IdFolder() As Byte
IdFolder = bytIdFolder
End Property
Public Property Let IdFolder(ByVal NewValue As Byte)
bytIdFolder = NewValue
End Property
crenaud76
Messages postés4172Date d'inscriptionmercredi 30 juillet 2003StatutMembreDernière intervention 9 juin 200628 7 avril 2004 à 15:51
Il te faut une "Public Property Set Auctions" ...
sinon
Set oaFolders(bytIndexFolder).Auctions(intIndexAuction) = New Auction
ne peut pas fonctionner !!!