Beispiel #1
0
        //initializarea formului si adaugarea masinilor (din enum) in combobox
        public Form1()
        {
            SelectedCar = Audi;

            InitializeComponent();

            carsList = new List <Car>()
            {
                Audi, Volkswagen, BMW, Hyundai, Lamborghini, Toyota
            };


            for (FuelType ce = FuelType.Benzina; ce <= FuelType.Hybrid; ce++)
            {
                comboBoxFuel.Items.Add(ce.Description());
            }

            //populate combobox with the items from enum

            CarModel myEnum = CarModel.AudiA3;
            string   myDesc = myEnum.Description();

            for (CarModel ce = CarModel.AudiA3; ce <= CarModel.ToyotaAuris; ce++)
            {
                comboBoxCar.Items.Add(ce.Description());
            }

            comboBoxFuel.DataSource = Enum.GetValues(typeof(FuelType)); //populate fuel combobox straight from Enum
        }