public ComboBox Automovil(ComboBox combo, string auto_marca_modelo_patente = "") { try { Automovil cliente_mapper = new Automovil(); List <Automovil> automoviles = cliente_mapper.ObtenerAutomoviles(); combo.DisplayMember = "Text"; combo.ValueMember = "Value"; combo.Items.Add(new { Text = "Seleccione el Automovil", Value = 0 }); foreach (Automovil automovil in automoviles) { combo.Items.Add(new { Text = automovil.marca.nombre + ' ' + automovil.modelo + ' ' + automovil.patente, Value = automovil.id }); } combo.SelectedIndex = 0; if (!String.IsNullOrWhiteSpace(auto_marca_modelo_patente)) { combo.SelectedIndex = combo.FindString(auto_marca_modelo_patente); } return(combo); } catch (Exception exception) { throw new Exception(exception.Message); } }