Bonjour a tous,

J'ai un problème, j'aimerai alimenter une checkedlistbox via mon fichier XML
J'ai réussi à le faire partiellement..
En effet ma checkedlistbox me retourne seulement le première élément et je n'arrive pas a voire d'où cela viens.

Voici mon fichier XML
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
 
<?xml version="1.0" encoding="ISO-8859-1"?>
<utilitaires>
	<taches type="Informatique">
			<tache>Maquettage</tache>
			<tache>Conception</tache>
			<tache>Validation</tache>
	</taches>
</utilitaires>
Voici mon code :
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
 
public static DataTable recupListeTache()
        {
            chargementFichierUtilitairesXml();
            XmlNodeList noeudsTaches = FichierUtilitairesXml.SelectNodes("//taches[@type='Informatique']");
            DataTable dttaches = new DataTable();
            DataColumn col0 = new DataColumn("Tache");
            dttaches.Columns.Add(col0);
 
            foreach (XmlNode noeudTache in noeudsTaches)
            {
                //Extracttion des données
                string test = noeudTache.SelectSingleNode("tache").InnerText.ToString();
                //Remplie la DataTable
                DataRow ligneTable = dttaches.NewRow();
                ligneTable[0] = test;
                dttaches.Rows.Add(ligneTable);
            }
            return dttaches;
        }
Et ici je charge la checklistbox
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
 
public void chargerLesCheckBox()
        {
            DataTable checkBoxDataTable = XmlTraitementsCommun.recupListeTache();
            for (int tache = 0; tache < checkBoxDataTable.Rows.Count; tache++)
            {
                checkedListBoxTache.Items.Add(checkBoxDataTable.Rows[tache][0].ToString());
            }            
        }

Je vous remercie d'avance pour votre aide !