Bonjour,

j'ai dans une application codée comme suite :

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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
 
Public Class Variables
    Public BOM As New List(Of Component) 'BOM finale
End Class
 
Public Class TraversAllComponents
            BOM.Add(New Component)
            ID += 1
 
            BOM.Item(ID).Patch = BOM.Item(ID).swComponent.GetPathName       'chemin du composant
 
            '==================
            ' Vérification si la configuration a déjà été traitée
            Dim x As Integer = 0
            If Not IsNothing(BOM.Item(ID).Configuration) Then
                For Each Y As Configurations In BOM.Item(ID).Configuration
 
                    If BOM.Item(ID).Configuration.Item(x).Name = BOM.Item(ID).ConfigurationName Then
                        Exit For
                    ElseIf x = BOM.Item(ID).Configuration.Count - 1 Then
                        BOM.Item(ID).Configuration.Add(New Configurations() With {.Name = BOM.Item(ID).Patch})
                    End If
 
                    x += 1
                Next
            Else
                BOM.Item(ID).Configuration.Add(New Configurations() With {.Name = BOM.Item(ID).Patch})
            End If
            '==================
 
End Class
 
 
Public Class Component
 
Private _Configuration As List(Of Configurations)   'Configuration du composant
    Public Property Configuration() As List(Of Configurations)
        Set(value As List(Of Configurations))
            _Configuration = value
        End Set
        Get
            Return _Configuration
        End Get
    End Property
 
Private _Path As String   'répertoire du composant
    Public Property Patch() As String
        Set(value As String)
            _Path = value
        End Set
        Get
            Return _Path
        End Get
    End Property
 
End Class
 
Public Class Configurations
 
    Private _Name As String   'Nom de la configuration
    Public Property Name As String
        Set(value As String)
            _Name = value
        End Set
        Get
            Return _Name
        End Get
    End Property
 
End Class
Aux ligne 21 et 27, je tente de créer une nouvelle "Configuration" mais sans succès.
L'erreur "La référence d'objet n'est pas définie à une instance d'un objet." m'est renvoyée.
J'ai cherché partout sur le net le pourquoi du comment mais je n'arrive pas à comprendre d'où vient mon problème.
Et je n'arrive pas à comprendre pourquoi cela ne fonctionne pas alors que la ligne 7 ne pose aucun problème ( BOM.Add(New Component) )

Quelqu'un saurait-il d'où vient le soucis SVP?

Merci!