Bonjour à tous,
Voila j'ai crée une petite fonction qui doit ajouter dans un TreeView des noms de fichiers suivant leur extension. Mais la génération me retourne une erreure !!! Aidez moi s'il vois plait, c'est super important.
Voila le code correspondant:
Public Sub Organisation(ByVal extension As String, ByVal index_parent As Integer, ByVal index_enfant As Integer)
Dim liste() As String = System.IO.Directory.GetFiles(My.Settings.Repertoire)
Dim item As String
For Each item In liste
If System.IO.Path.GetExtension(item) = extension Then
Dim item_ext As TreeNode = TreeView1.Nodes(index_parent).Nodes(index_enfant).Nodes.Add(item)
item_ext.Name = item
item_ext.Text = System.IO.Path.GetFileNameWithoutExtension(item)
End If
Next
Dim Sous_Dossiers As String
Dim Liste_Sous_Dossiers As String() = Directory.GetDirectories(My.Settings.Repertoire)
For Each Sous_Dossiers In Liste_Sous_Dossiers
Organisation(Sous_Dossiers, index_parent, index_enfant)
'MessageBox.Show(Sous_Dossiers.ToString)
Next
End Sub
Visual Studio me retourne une erreur du type :
Une exception non gérée du type 'System.StackOverflowException' s'est produite dans mscorlib.dll
PS: J'ai besoin d'appeler 14 fois cette fonction car j'ai 14 types de fichiers.
Merci beaucoup d'avance.