Bonjour,

j'ai le code suivant
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
 
 
            if (this.listView2.Groups.Count != 0)
            {
 
                //this.listView2.Items.Clear();
                ListViewGroup testgroup = new ListViewGroup(this.listView2.li.SubItems[1].Text, HorizontalAlignment.Left);
                int index3 = this.listView2.Items.IndexOf(this.listView2.li);
              // for (int i90 = 0; i90 < this.listView2.Items.Count; i90++)
            //    {
 
                    foreach (ListViewGroup groupcuisine in toRemove2)
 
                    // foreach (ListViewGroup groupcuisinee in toRemove)
                    {
                        bool b = false;
                        string groupcommentaire = groupcuisine.ToString();
                        string chainefinale = "";
                        string chaine = "";
                        b = groupcommentaire.Contains("   ");
                        if (b == true)
                        {
                            chaine = groupcuisine.ToString();
                            string espaces = "   ";
                            chainefinale = chaine.Substring(0, chaine.IndexOf(espaces));
 
 
                        }
                        else
                        {
                            chainefinale = groupcuisine.ToString();
 
                        }
                        if (groupcuisine != null )
                        {
                            int groupIndex = this.listView2.Groups.IndexOf(groupcuisine);
 
                                if (this.listView2.li.SubItems[1].Text.ToString() == chainefinale)
                                {
                                    // this.listView2.li.Group = this.listView2.Items[i90].Group;
                                    this.listView2.li.Group = groupcuisine;
 
 
                                }
 
 
 
                        }
                    }
A chaque fois ca me renvois un message d'erreur
Cannot add or insert the item .....
Je vois pas d'ou ca peut venir je galere a trouvé .

Merci