public ShelfSelector() { InitializeComponent(); IDatabaseDriver databaseDriver = AzusaContext.GetInstance().DatabaseDriver; if (databaseDriver != null) { IEnumerable <Shelf> shelves = databaseDriver.GetAllShelves(); foreach (Shelf shelf in shelves) { comboBox1.Items.Add(shelf); } } else { Shelf dummy = new Shelf(); dummy.Name = "This won't work in the designer!"; comboBox1.Items.Add(dummy); } comboBox1.SelectedIndex = 0; }