private void set_hours() { List<string> hours = new List<string>(); DateTime DT = Test_datePicker.SelectedDate.Value; DT = DT.AddHours(9); for (int i = 9; i < 15; i++) { var v = myBL.Available_testers_nearby(DT, trainee.Address, trainee.Car_type, trainee.Gear_type); if (v.Count() != 0) hours.Add(i + ":00"); DT = DT.AddHours(1); } Test_hourComboBox.ItemsSource = hours; }