Voila j'ai un pb Objet que je ne comprends pas. Je ne peux accéder à une propriété de classe.
Avant j'étais passer par un type
Puis utilisation :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 Type ComboInformation1 code() As Long libelle() As String End Type
=> Pas de souci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 Dim combotruc As ComboInformation1 ReDim combotruc.code(1 To 2) ReDim combotruc.libelle(1 To 2) combotruc.code(1) = 1 combotruc.code(2) = 2 combotruc.libelle(1) = "toto" combotruc.libelle(2) = "tata"
Souhaitant transformer mon type en objet (pour l'inclure dans un autre objet)
Définition de la classe ComboInformation
Puis utilisation
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 Option Explicit Option Base 1 Private code() As Long Private libelle() As String Public Property Get getCode() As Long Set getCode = code End Property Public Property Get getLibelle() As String Set getLibelle() = libelle() End Property Public Property Let letCode(item As Long) code(item) = letCode(item) End Property Public Property Let letLibelle(letLibelle As String) libelle = letLibelle End Property Public Sub Class_Initialize() ReDim code(1 to 2) ReDim libelle(1 to 2) End Sub
Et c'est la que j'ai un pb de compil pour utilisation incorrecte de la propriété.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 Dim d As New ComboInformation d.letCode(1) = 1
Je ne vois pas pourquoi, mon objet est bien instancié.
Merci par avance
![]()
Partager