public ComboBox Chofer(ComboBox combo, string chofer_nombre_apellido = "") { try { Chofer chofer_mapper = new Chofer(); List <Chofer> choferes = chofer_mapper.ObtenerChoferes(); combo.DisplayMember = "Text"; combo.ValueMember = "Value"; combo.Items.Add(new { Text = "Seleccione el Chofer", Value = 0 }); foreach (Chofer chofer in choferes) { combo.Items.Add(new { Text = chofer.nombre + ' ' + chofer.apellido, Value = chofer.id }); } combo.SelectedIndex = 0; if (!String.IsNullOrWhiteSpace(chofer_nombre_apellido)) { combo.SelectedIndex = combo.FindString(chofer_nombre_apellido); } return(combo); } catch (Exception exception) { throw new Exception(exception.Message); } }