private void LoadFuels() { List <KeyValue> listoffuels = KeyValueRepository.GetFuelTypes().ToList(); if (listoffuels.Count > 0) { cmb_fueltypes.DataSource = listoffuels; cmb_fueltypes.DisplayMember = "Name"; cmb_fueltypes.ValueMember = "Id"; cmb_fueltypes.SelectedIndex = 0; } }
private void LoadFuels() { try { List <KeyValue> listoffuels = KeyValueRepository.GetFuelTypes().ToList(); if (listoffuels.Count > 0) { cmb_fueltypes.DataSource = listoffuels; cmb_fueltypes.DisplayMember = "Name"; cmb_fueltypes.ValueMember = "Id"; cmb_fueltypes.SelectedIndex = 0; } } catch (Exception ex) { MessageBox.Show("Error Has found when loading data. Please forword following details to technical" + Environment.NewLine + "[" + ex.Message + Environment.NewLine + ex.Source + "]", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); } }