private void RebuildFoldersCombo() { // remove everything comboBoxFolders.Items.Clear(); // the text and value. comboBoxFolders.DisplayMember = "Text"; comboBoxFolders.ValueMember = "Value"; // and set the folder values. var items = new List <object>(); // select the first item var selectedIndex = 0; // we can have is 'n/a' if we want no folders items.Add(new { Text = "n/a", Value = "" }); // go around all the folders. foreach (var folder in _folders.GetFolders()) { // is that our current one? if (GivenCategory?.FolderId == folder.Id()) { selectedIndex = items.Count; } items.Add(new { Text = folder.Path(true), Value = folder.Id() }); } // the data source. comboBoxFolders.DataSource = items; // do we have any folders? if (!_folders.GetFolders().Any()) { // there is nothing to select here, nothing much we can do really. // so we select the first item, (the 'n/a' one) comboBoxFolders.SelectedIndex = 0; comboBoxFolders.Enabled = false; } else { // select our current one. comboBoxFolders.SelectedIndex = selectedIndex; } }