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
| System.Collections.Generic.List<ListViewGroup> toRemove = new System.Collections.Generic.List<ListViewGroup> ();
ListViewGroupCollection[] toNew = new ListViewGroupCollection[this.Groups.Count];
// ListViewGroupCollection toRemove = null;
// toRemove = this.Groups;
// ListViewGroupCollection toNew = new ];
//toNew = this.Groups;
/*
foreach (ListViewGroup groupcuisine in toRemove)
{
this.Groups.Remove(groupcuisine);
}
*/
foreach (ListViewGroup groupcuisine in this.Groups)
{
//this.listView2.Items.Clear();
for (int i90 = 0; i90 < this.Items.Count; i90++)
{
ListViewGroup testgroup = new ListViewGroup(this.Items[i90].SubItems[5].Text, HorizontalAlignment.Left);
if (testgroup != null)
{
if (testgroup.ToString() == groupcuisine.ToString())
{
this.Items[i90].Group = groupcuisine;
toRemove.Add(groupcuisine);
}
else
{
//ListViewGroup testgroup = new ListViewGroup(li.SubItems[subItemSelected].Text, HorizontalAlignment.Left);
//MessageBox.Show(textBoxDesignation.Text + " a été ajouté correctement à la désignation", "Modification Designation", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Groups.Insert(0, testgroup);
this.li.Group = testgroup;
toRemove.Add(groupcuisine);
}
}
else
{
//ListViewGroup testgroup = new ListViewGroup(li.SubItems[subItemSelected].Text, HorizontalAlignment.Left);
//MessageBox.Show(textBoxDesignation.Text + " a été ajouté correctement à la désignation", "Modification Designation", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Groups.Insert(0, testgroup);
this.li.Group = testgroup;
toRemove.Add(groupcuisine);
}
foreach (ListViewGroup groupcuisine in toRemove)
{
this.Groups.Remove(groupcuisine);
}
}
} |
Partager