if(App.ActiveCellar == null) { MessageBox.Show("Aucune cave n'est ouverte."); return; } ObjectCollection categories = App.ActiveCellar.GetCollection((ushort)ObjectType.Category); string VinsName = "Vins"; BaseItem ret = null; for (int i = 0; i < categories.Count; i++) { BaseItem item = (BaseItem)categories[i]; if (item.Name.Trim() == VinsName) { ret = item; break; } } if (ret == null) { MessageBox.Show("Catégorie \"" + VinsName + "\" introuvable.\nImpossible de continuer."); return; } ObjectCollection wines = App.ActiveCellar.GetCollection((ushort)ObjectType.Wine); for (int i = 0; i < wines.Count; i++) { Wine wine = (Wine) wines[i]; //Température if (wine.Category.Name.Trim() == String.Empty) { wine.Category = (Category) ret; wine.Save(); } }